This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Running TivaWare_C_Series-1.0 freertos_demo on TM4C1233D5PM or other chip with less sRAM and avoid hardFault handler

Other Parts Discussed in Thread: TM4C1233D5PM, EK-TM4C123GXL

The freertos_demo runs fine on the LaunchPad demo board (EK-TM4C123GXL). That processor has 256k of Flash and 32k of sRAM (the maximum in the Tiva series). We designed a board using the TM4C1233D5PM which has 64k of Flash and 24k of sRAM. After changing to PART_TM4C1233D5PM in the #define in the build file and changing the target device from LM4F120H5QR to LM4F120C4QR in the IAR project we found that it didn't run. In fact, we got a hard fault error during startup.

The reason for the hard fault was a memory error during initialization (before reaching main()). Two changes were made to avoid this. First, in the IAR freertos_demo.icf file used by the linker, the flash memory size was changed to read:

//define region FLASH = mem:[from 0x00000000 to 0x0003ffff];
// 64k for TM4C1233D5PM 65535. = 0x10000 - 1 = 0xffff
define region FLASH = mem:[from 0x00000000 to 0x0000ffff];

The sRAM region was changed to read:

//define region SRAM = mem:[from 0x20000000 to 0x20007fff];
// 24k for TM4C1233D5PM 24575. = 0x6000 - 1 = 0x5fff
define region SRAM = mem:[from 0x20000000 to 0x20005fff];

Then we noticed in the map file that heap_2.o (a freeRTOS file) was taking up more sRAM than we had on the chip. In FreeRTOSConfig.h this is specified on this line:

#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 30000 ) )

which we changed to:

#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10000 ) )

It's tough debugging a hard memory fault, but hopefully this will save you some time trying to bring up FreeRTOS on variants in the Tiva series.