Compiling MicroPyton with IAR & Keil c compiler

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
UV100
Posts: 6
Joined: Mon May 22, 2017 4:25 pm

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by UV100 » Sun Feb 11, 2018 1:07 pm

Dear Stijn

I didn't say the project is bad !!!

It is a good project who create a good surrounding community, I salute you and any others who work on this project for the work you have done....

I spent lot of time trying to compile it on different environment (IAR ,Keil, Ads ) and encounter lots of errors - mostly due to some header files not wiling to compile no meter what,I have try....

There is lack of information(documentation) regarding those macro files - what is the purpose,how to re compile them , how to use them in other compilers and in different environment?

A professional written project with good software engineering in mind would have more information embedded with in ,as adding remarks and documentation sometime is more important then the code himself and somewhat easy to move from one compiling environment to another.

I think it will be a grate benefit for you whether this project can be used by "professional" user's and not limited to hobbyist makers who can only used free tools.

UV100

User avatar
pythoncoder
Posts: 2991
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by pythoncoder » Sun Feb 11, 2018 1:44 pm

The idea that free == worse is antediluvian. Dissing open-source as "for hobbyists" is worthy of the Steve Ballmer "Linux is a cancer" interview of 17 years ago.

gcc, GNU Make and Git are widely used professionally. So, for that matter, is CPython. And Linux.
Peter Hinch

chrismas9
Posts: 73
Joined: Wed Jun 25, 2014 10:07 am

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by chrismas9 » Sun Feb 11, 2018 2:00 pm

I have been building STM32 ports easily and successfully with Atollic True Studio lite on Windows 7 & 10 for some time. It is easy to import an existing makefile project. You need to install MSYS2 for the gnu utilities and set the cross compiler to CROSS_COMPILE = arm-atollic-eabi- in the build target.

ST have acquired Atollic and now offer the full version for free. If you want a "professional" tool with IDE and advanced analysis and debugging then True Studio may do what you want.

Had MicroPython been developed for IAR it would never have achieved the level of community support that has helped develop and test it to where it is now.

stijn
Posts: 269
Joined: Thu Apr 24, 2014 9:13 am

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by stijn » Sun Feb 11, 2018 4:40 pm

UV100 wrote:
Sun Feb 11, 2018 1:07 pm
A professional written project with good software engineering in mind would have more information embedded with in ,as adding remarks and documentation sometime is more important then the code himself and somewhat easy to move from one compiling environment to another
Ok I have a better understanding of your point now. Though I still think it is not entirely correct: yes there is no explicit documentation/user manual for e.g. these header files, but in my opinion it is not really needed (because everything is to a degree self-explanatory) and especially not after a cost/benefit analysis from the point of view of the authors (who'd rather spend time moving the project forward instead of spending a lot of time on documenting every bit of the code and/or build process which might not ever be read). Coincidentally I already stated the exact same thing a couple of days ago here wrt to the code itself: viewtopic.php?f=3&t=4069&start=10#p25250.
I think it will be a grate benefit for you whether this project can be used by "professional" user's and not limited to hobbyist makers who can only used free tools.
The place where I introduced MicroPython, and for which I ported it to windows/msvc, is exactly what I'd call "professional" usage. Buys Visual Studio, pays people to use it with MicroPython, has like >20k loc of C++, Labview and Matlab code all controlled by MicroPython, uses it to perform time-critcical tasks for scientific experiments. Ok not everything is time-critical, but it's science so things should run 100% correct plus there's sometimes people + robots involved so there's also a safety aspect, e.g. we have a robot with enough power in the arms to knock people unconscious, you don't usually find that in the hobbyiste maker space.

Anyway: all that just to illustrate that what you want is possible. Though it does take some studying of the code/makefiles and I understand it can be off-putting if it doesn't work immediately. As I went through that phase myself. But I surely did learn a lot from it.
chrismas9 wrote:
Sun Feb 11, 2018 2:00 pm
It is easy to import an existing makefile project.
well yes but UV100's point is he cannot use those Makefiles, I think :)

chrismas9
Posts: 73
Joined: Wed Jun 25, 2014 10:07 am

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by chrismas9 » Sun Feb 11, 2018 9:47 pm

UV100, you didn't state your reason for wanting to use IAR or Keil. Is it 1) you have existing C projects you want to integrate with MicroPython, 2) you already own IAR and Keil, 3) you want an IDE with editor, compiler analysis tools and debugger.

You may find it easier to build MicroPython with Atollic and incorporate your code into the make / gcc build. Atollic use Eclipse, gcc and gdb with their own extras including good support for STLink and Jlink.

tomlogic
Posts: 13
Joined: Tue Jul 19, 2016 10:20 pm

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by tomlogic » Fri Mar 09, 2018 5:28 pm

It is possible to compile MicroPython with IAR Embedded Workbench. I've ported it to run inside of Digi International's XBee products (currently Cellular and Zigbee) on SiLabs EFM/EFR hardware. Some issues I encountered:
  • Since IAR uses a project file instead of a Makefile, I had to manually add the source files to my build. As I was bringing the platform up, I started with the "minimal" platform and would add C files whenever the linker complained about something missing.
  • Because it doesn't use the Makefile, I have to manually run make from a MinGW/MSYS bash prompt to generate QSTRs. I was able to create a pre-compilation .cmd script to update the version information, and plan to update it to handle QSTR generation at some point.
But I am not using it to build the STM target, so I can't speak to challenges related to that.

terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

Re: Compiling MicroPyton with IAR & Keil c compiler

Post by terrancepeiris » Thu Sep 27, 2018 4:32 am

Guys, I am in windows 7 and Windows 10 machine with MinGW/MSYS. I can STM32F769 Disco board compile using make and it is working fine.

I port this into IAR and getting lot of errors, Is anyone successfully compile using IAR

Post Reply