FreeRTOS on MSP430F5438 with MspGCC

anonymous wrote on Monday, April 16, 2012:

Hello,

I’m a student, and also a complete beginner on FreeRTOS; the thing is, i need to make it work on a MSP430F5438 (implemented on an Olimex MSP430-5438-STK board), using the MSPGCC compiler; After trying to do it on my own during the last few days, I resigned myself to ask for help.

As no Demo was available for my specific configuration, i started to do a port based on the available demos and several documentations i found on the Web, but actually, my program doesn’t work:
* I created two tasks (simple LED blinks at different speed), but it seems that only the latest task is continuously working; after googleing a bit, i found that the function vPortYieldFromTick() wasn’t implemented, so i wrote it in my “port.c” file and i called it from the timer0’s ISR. But it gone worse, as the LEDs didn’t even blink.
I tried to “follow the problem”, and it looks like the problem is located in the portSAVE_CONTEXT() and portRESTORE_CONTEXT() macros; unfortunately, they’re written in assembler, and a don’t know a single thing about it…
But maybe i’ve passed through something important ?

Thank you in advance for your help, i really don’t know where else i could ask for it…

P.S.: I voluntarily not included any source code with this post to not make it too long, but if needed, i can put it online

PS: Sorry for my bad english :slight_smile:

rtel wrote on Monday, April 16, 2012:

The FreeRTOS download contains an MSP430 port for GCC, but not an MSP430X port for GCC.  However, it contains both an MSP430 and and MSP430X port for IAR.  I therefore suggest comparing the directorie

FreeRTOS\Source\portable\IAR\MSP430

with the directory

FreeRTOS\Source\portable\IAR\MSP430X

to see the changes that are required to support the extended architecture, then make the same changes to the existing FreeRTOS MSP430 GCC port.

Regards.

anonymous wrote on Tuesday, April 17, 2012:

Thank you to put me back on track :slight_smile:

To be shure to have the right files, i started a new project and i’m actually trying to understand how to use the “portext.s43” file within it, as the save/restore context macros are in.
If anyone has some tip’s on how to do so, i’m okay with it ;-D

Anyway, thank you for the answer you gave, it helped me a lot.

edwards3 wrote on Tuesday, April 17, 2012:

If GCC for MSP430 supports the naked function attribute, it is easiest to transfer the assembly code out of the assembly file and into a C file. To do this you define a function as naked to stop the compiler adding any assembly to the function entry point, and then use __asm volatile to write assembly instructions.

Update. Just looking at the Source\portable\GCC\MSP430F449\port.c file I see this is what FreeRTOS is doing already. Look at the function vPortYield(). The portSAVE_CONTEXT and portRESTORE_CONTEXT macros are asm macros and defined in the same file.

anonymous wrote on Wednesday, April 18, 2012:

Thanks Edwards :slight_smile:

I’ve moved assembler code in some macros defined in port.c, but at the moment i’m encountering some syntax problems, obviously the assebler syntax differs from IAR to GCC…
I’m now investigating the internet to find how to correct it, as i don’t have any assembler notions.
But it also looks like i’m using an old/not supported anymore MSPGCC compiler, so i guess i shall better install a newer/supported one before continuing.

pabigot wrote on Sunday, June 10, 2012:

I’ve got the beginnings of a port for MSPGCC at https://github.com/pabigot/freertos-mspgcc.  A primary goal of this effort is to provide a test environment for non-trivial 20-bit-capable applications using MSPGCC, and at the moment it will probably only work correctly with the current development series available at https://sourceforge.net/projects/mspgcc/files/mspgcc/DEVEL-4.7.x/.  I could probably be talked into adding support for the LTS_20120406 release.

There’s a very trivial demo for the EXP430F5438, and another for the EXP430G2 (Launchpad) using the MSP430G2553.  The RAM limitations of the MSP430G2553 make it barely usable, but the demo for it does allow two flash coroutines to exist. More platforms and features are expected soon.

See https://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=MSPGCC_Wiki for general information about mspgcc.