Migrate C/C++ applications from Teensy/Arduino to MCUXpresso. - Page 1
Forum section: electronics / general

author: luiHS
author_rank: Frequent Contributor
timestamp: April 16, 2020, 05:02:12 pm
content: Hi.Does anyone know of any simple or automated system to migrate a C/C++ development from Teensy/Arduino to MCUXpresso?Some time ago I was trying to understand the intricate and hidden structure of the internal sources and libraries developed with Arduino, and the truth is that I found it quite complex. It is one of the things that I have never liked about Arduino, in addition to its terrible and basic IDE, all the things that are hidden and do not let you migrate a development to other environments, even being the same microcontroller and same GCC compiler.Regards.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: April 16, 2020, 06:13:38 pm
content: I have ported a few Arduino projects to other platforms, the simple way is to rewrite the application until it runs. It's just code. If by "simple" you mean "not time consuming" then no there isn't.As for automated, I very much doubt that. If its an Arduino/AVR project you can import it into Atmel Studio. What is your source and target CPU? There are several flavors of Teensy.

author: luiHS
author_rank: Frequent Contributor
timestamp: April 16, 2020, 07:05:57 pm
content: Quote from: donotdespisethesnake on April 16, 2020, 06:13:38 pmIts a Kinetis MK66.

author: tmadness
author_rank: Regular Contributor
timestamp: April 16, 2020, 07:18:02 pm
content: Sounds like a job for python, for the adventurous. I have in the past though about something like this but ended doing what donotdespisethesnake did, hack-compile-transfer lib-repeat

author: westfw
author_rank: Super Contributor
timestamp: April 16, 2020, 10:29:22 pm
content: QuoteI don't understand what you're talking about.The Arduino build process is trivial (to the point of being annoying) and pretty transparent and obvious. Much more obvious than theaverage auto-generated template-based Makefile, for instance.If you turn on "Verbose" compilation in the Arduino IDE preferences, the build window will show every compilation-related command that happens. Aside from the pre-processing of the user sketch itself, which is "not much", you just have a chain of standard gcc tool usage.I copy&paste compile/etc commands from the IDE to a CLI shell all the time to add/adjust some parameter that isn't changeable from within the IDE.In addition, there's a well-documented "3rd party board" description explaining the "patterns" used for creating the compile commands, AND the whole mess of stuff (IDE, cores, libraries, etc) is all Open Source...

author: brucehoult
author_rank: Super Contributor
timestamp: April 16, 2020, 11:52:49 pm
content: Quote from: westfw on April 16, 2020, 10:29:22 pmYeah, I'm with you.Sure the IDE is a bit basic, but it is functional and certainly a lot lot better than Notepad, which a surprising number of people seem to be happy with. And you can use an external editor if you want.It's easy to find the source code for something like digitalWrite() for any given MCU, and it's not hard to understand. It's usually a bit *long* -- like 20 or 50 lines of code -- because of the flexibility of being able to specify the pin number dynamically, and mapping Arduino pin numbers to board pin numbers etc. But if you can't understand it then you probably don't have much chance of writing your own code using MCU registers directly anyway, so ...

author: ehughes
author_rank: Frequent Contributor
timestamp: April 17, 2020, 02:20:03 am
content: Just start a new MCUXpresso C++ project. It already initialized the environment.To be honest, I can't image there is much in the libraries that can't be reimplemented quickly.I would just take stock on what you are actually using and go from there. If you poke around in the arduino install folder you can find all of the porting layers and c++ classess that you could just copy into the build system.If there is some teensy specific library you want to re-use, it shouldn't be hard to find in the filesystem.IMHO, your best bet is to forget that your Arduino even exists and start over.