Hi, I'm newbie to MicroPython plattform.
Actually, I develop firmware in C language, using FreeRTOS. I want to know if there are tutorials explaining how to port the MicroPython interpreter to a specific hardware plattform, in my case a custom LPC1768 (Cortex-M3) board. Since I'm newbie, I've many doubts, listed below:
Is the interpreter source code available in C language, so that I can use a established an working environment to compile it?
How do I establish the link between the interpreter and existing HAL functions? Is there a default or more convenient way to do this?
Can I get some advantages by using the already working FreeRTOS plattform to run the interpreter?
Thanks in advance!
Running MicroPython on custom hardware
Re: Running MicroPython on custom hardware
I've started working with micropython less than 2 months ago so take that into account with respect to my advice.
I'd start with the ports/minimal or ports/bare-arm.
If you need more info i.e. a comment on a line of code, go to the github commit message for that file.
You're using ARM which is good because the exception framework uses ARM assembly (though I ?think you can choose not to? Irrelevant because you're using ARM so don't worry about it).
If FreeRTOS uses preemptive multitasking, you won't have to do that.
There's not tutorials on the C-code, unfortunately, meaning you'll have to figure out how to modify the many tables of function pointers to add your own functionality. Even the comments in the code are less verbose than I'd like.rzingler wrote: ↑Wed Nov 01, 2017 2:41 amHi, I'm newbie to MicroPython plattform.
Actually, I develop firmware in C language, using FreeRTOS. I want to know if there are tutorials explaining how to port the MicroPython interpreter to a specific hardware plattform, in my case a custom LPC1768 (Cortex-M3) board.
I'd start with the ports/minimal or ports/bare-arm.
If you need more info i.e. a comment on a line of code, go to the github commit message for that file.
You're using ARM which is good because the exception framework uses ARM assembly (though I ?think you can choose not to? Irrelevant because you're using ARM so don't worry about it).
Yes. The code is available here https://github.com/micropython/micropython/releases
You have to look in the code for HAL-related functions. Search for "LED", "ADC", "timer" and you'll quickly find where you need to add your specific HAL code. There's not some kind of easy generator script that auto-generates the HAL functions using your own plugin functions but it's really not hard.
I have zero knowledge of FreeRTOS (or even other RTOS) but I will say that I'm integrating micropython into a cooperative multitasking OS which is a pain because I have to modify micropython source code to explicitly call MyRTOS.yield().
If FreeRTOS uses preemptive multitasking, you won't have to do that.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Running MicroPython on custom hardware
There is an official MicroPython port for the Zephyr RTOS.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.