Hello andyknitt,
From what I can see, the problem is that you run out of memory. Let me go into a few details regarding our linker file:
At the top you can find the heap and stack sizes defined:
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000400;
After those, you can find the memory areas defined (in bold what's important to your issue):
/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0003FBF0
/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFFE000, LENGTH = 0x00002000
/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00001000
}
If we go further, we can see that m_data_2 is comprised of the following:
- customSectionBlock
- bss
- heap
- stack
The first 3 sections are placed one after the other in memory, while the stack is placed staring from the end of m_data_2.
At the end we have the following assert
ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
where we check that stack and heap don't overflow. In your case the bss gets so big that pushes the heap over the stack. To bypass this, you can change the HEAP_SIZE or STACK_SIZE, but that depends on what you are looking for. When you're not using that toolbox, the bss is smaller and heap and stack are not overlapping.
If you want to change the heap/stack sizes, the file you'll want to edit is found here:
{ROOT_DIR}\mbdtbx_s32k14x\src\linker\gcc\S32K142_16_flash.ld
(or _32_flash.ld at the end, depending on what SRAM you have on your S32K - you can select the option from the main configuration block - MCU tab - SRAM).
I did some tests and found that your application Dual_CAN_Test_Build_Fails works with the following adjustments:
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x000003F0;
So with just a slightly lower value for STACK SIZE, you can make it work - but when you'll make a more complex model that will put more data in the .bss you'll probably get the same error. I can not really know how it's more beneficial for you to manage the heap/stack/bss sizes.
P.S.: in the <model_name>_rtw folder generated when building a model, you can find the linker file under the name of S32K14x.ld, regardless of the selected MCU.
Hope you find this helpful,
Razvan.