I was running some tests today with MQX to see how the .bss section grew with changes to the task stack. While the results are generally predictable (at least I thought so), I was surprised when I adjusted the stack size of one of my tasks, and then I ended up with this error:
c:/freescale/kds_3.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: KDS3_RobotAxis.elf section `.bss' will not fit in region `m_data'
c:/freescale/kds_3.0.0/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: region `m_data' overflowed by 784 bytes
A quick search led me to Erich Styger's post FreeRTOS Heap with Segmented Kinetis K SRAM | MCU on Eclipse . After looking at the various Kinetis reference manuals, all three of the chips I'm using have the split memory architecture. I guess I had been lucky up until now to not even realize this is how the processors are designed.
Well, now I'm going to need to get above the 8K lower limit of the MK22FN128FLL10. Erich had modified his FreeRTOS component to allow the specification of the location of the heap. I'm using the PEx MQX component, and as far as I can tell, it does not have such an option. Looking at the linker file, I see that there is an m_data and m_data_2 defined.
How can I make the necessary changes to MQX so that my task stacks are allocated in m_data_2? Also, are there any issues with tasks accessing data (maybe a global variable) that is defined in m_data? I apologize for the dumb question, but this is the first time I've dealt with a split memory architecture that doesn't have the details of crossing the boundary abstracted from the user.