micropython + FreeRTOS

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
braiins
Posts: 19
Joined: Mon Feb 23, 2015 1:09 pm
Contact:

micropython + FreeRTOS

Post by braiins » Mon Feb 23, 2015 1:33 pm

Hi,

I am just wondering if there are any development efforts/projects related to running micropython in FreeRTOS? Our company has a solid framework based on FreeRTOS for LM3Sxxxx(obsolete MCU's from TI), and Renesas RX600 platform. Is there any documentation for porting micropython to a new target? https://github.com/micropython/micropython/wiki/porting doesn't seem to be started yet.

This question is mostly meant to prevent wasting any development effort in case something exists already. We are strongly decided to start this project. The basic idea is that porting micropython to use our HAL (we call it freertos-drivers) & FreeRTOS would immediately provide support for RX600 platform and any others. Our HAL provides abstraction for basic set of peripherals (GPIO, CAN, I2C, UART, PWM, input capture, watchdog).

Is there any documentation for the GC implementation?

Best regards,

Jan Capek
braiins - Your partner in embedded world - http://www.braiins.cz

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: micropython + FreeRTOS

Post by Damien » Mon Feb 23, 2015 7:43 pm

MicroPython is OS agnostic and easily fits within FreeRTOS.

The cc3200 port https://github.com/micropython/micropyt ... ter/cc3200 uses FreeRTOS so this is a very good place to start looking how to get it running on your system. See also the minimal port https://github.com/micropython/micropyt ... er/minimal for a minimal working example of MicroPython.

There is no GC documentation right now...

User avatar
braiins
Posts: 19
Joined: Mon Feb 23, 2015 1:09 pm
Contact:

Re: micropython + FreeRTOS

Post by braiins » Mon Feb 23, 2015 9:24 pm

Thank you for a quick response, I will have a look at the CC3200 port. As of the minimum port did you mean the the bare-arm port as pointed to in the toplevel project README.md?
braiins - Your partner in embedded world - http://www.braiins.cz

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Post by Damien » Tue Feb 24, 2015 10:23 am

Bare-arm is truly bare. Minimal is bare-arm plus some bits to make it actually run.

User avatar
filartrix
Posts: 1
Joined: Tue Jun 09, 2015 9:59 am

Re: micropython + FreeRTOS

Post by filartrix » Tue Jun 09, 2015 10:31 am

Hi everybody,
we're trying to run uPython as a Freertos task with MPU protection enabled, on a STM32F411 MCU (Nucleo board).
As of now we succeeded in the implementation of MPU in Freertos on the M4 and uPY as a task of Freertos.
things get difficult wen we combine the two: uPY can run as a privileged task, but I'm not able to let it run as a restricted task, also giving R/W permission to most of the memory (only Freertos core privileged).
I've spotted the issue and it seem to be in a couple of assemby instructions (nlr_push and nlr_pop): https://github.com/micropython/micropyt ... nlrthumb.S

What I've don is to change assembly code replacing STR and LDR instructions with unprivileged version: STRT and LDRT as described here:
http://infocenter.arm.com/help/index.js ... BIBGJ.html
that did not solve the issue either.
As workaround I've simply bypassed the function:

Code: Select all

outer_dispatch_loop:
        if (nlr_push(&nlr) == 0) {
            // local variables that are not visible to the exception handler
            
modified to:

Code: Select all

outer_dispatch_loop:
		if (1) {
            // local variables that are not visible to the exception handler
which are the implications of what I've done?
can anyone suggest a less brutal solution?
Thanks

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: micropython + FreeRTOS

Post by danicampora » Tue Jun 09, 2015 10:41 am

which are the implications of what I've done?
Exception handling is NOT going to work at all.

Post Reply