Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


PIC32 + Lua + FreeRTOS Problems

Posted by Nathan Wiebe on April 3, 2012
I'm not sure how likely I am to find a solution to my problem(s), but I hope to shed some light for people heading in the same direction as me.

Long story short: Getting Lua running on FreeRTOS on PIC32 has been a huge battle. Here's what doesn't work:
A) Using the new C30 libc libraries doesn't work even with stock Lua (no FreeRTOS). Random crashes.
B) Any floating point operations in the simulator from a FreeRTOS thread. If called before starting the scheduler, they work. After, they return garbage. So... don't depend on the simulator.
C) Floating point (lua_Number defined to double) Lua from a thread. Even basic operations return garbage. (e.g. 5 * 7 gives 5.5623e-315). They work from main(), but not once the scheduler is started.
D) I should note that I read of another guy porting Lua who mentioned that the debug build broke Lua (w/o an RTOS). I haven't experienced this, but be warned. Google: "ASKr PIC32 Lua". He also confirms A)

Here's what does work:
A) Stock Lua with no FreeRTOS (in simulator, and in debug and release on real hardware) using the legacy libc.
B) Integer Lua (lua_Number defined as long rather than double) from a thread, but only on real hardware.

I've tried all the obvious (huge stack, huge heap, etc, etc.), optimizations on the code and libc off, only one thread running throughout, ...

-I REALLY don't want to go with a stock Lua (without FreeRTOS) because of the power of the RTOS and the rich set of drivers I've written.
-I REALLY don't want to go with an integer version of Lua either.

This really took Microchip down a couple pegs in my books. Combining 2 well-written, established pieces of code should not be such a battle, but random issues with Microchip software and libraries have made it so.

Anyone out there with any ideas? Anyone actually get something like this working?

RE: PIC32 + Lua + FreeRTOS Problems

Posted by Richard on April 3, 2012
Can't help directly - but if you get something usable I would really appreciate it if you could upload it to the FreeRTOS Interactive site.

I seem to recall, a long time ago, that there were some users using a scripting language with FreeRTOS. I think there was one called "small", which later changed its name (trying to Google for something called "small" is hopeless so I can't find what it is called now - maybe it is related to Lua?).


RE: PIC32 + Lua + FreeRTOS Problems

Posted by Mike on April 3, 2012
There was a Small scripting language, based on 'Small-C compiler' which renamed itself into prawn. It doesn't seem to be related to Lua.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner