BriscoeTech / Arduino-FreeRTOS-SAMD21

A port of FreeRTOS that runs on Arduino Samd21 boards
63 stars 19 forks source link

Error when I try to compiled with an SAMD21E17A #34

Closed simon88 closed 1 year ago

simon88 commented 1 year ago

HI,

I'm trying to compile Basic_RTOS_Example but i got an error when I compiled.

Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: /var/folders/hd/yr_ffpg50yq3181_k4mmqvl80000gn/T/arduino_build_669244/Basic_RTOS_Example.ino.elf section `.bss' will not fit in region `RAM'
Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: region RAM overflowed with stack
Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: region `RAM' overflowed by 1240 bytes
collect2: error: ld returned 1 exit status

It's seem there is an error with the RAMregion.

BriscoeTech commented 1 year ago

Hello simon88,

Ahh yes, the SAMD21E17A comes with half as much ram as the samd21G18A that most samd arduinos come with. You will have to modify the configTOTAL_HEAP_SIZE inside FreeRTOSConfig.h to be way smaller. This defines the giant chunk of memory that is allocated at compile time for the rtos to use as it heap for making tasks stacks and freertos objects.

You can try something 1/2 or 1/3 of what it is now, and that should get you going. I always recommend adjusting the heap size depending on your projects needs so you can optimize the heap space vs global ram space for libraries and global objects and variables.

Good luck!

simon88 commented 1 year ago

Hi @BriscoeTech , Nice thanks for your answer, I've updated configTOTAL_HEAP_SIZEby 7 * 1024and now it's works perfectly great