Using the default linker file for the S32k144 that the S32DS comes with, the linker fails to generate an error when the allowed size for the m_text is exceeded. Looking at the linker file it doesn't directly put the data ROM into m_text but rather creates some variables and uses those. This prevents the linker from generating an error when the assigned sized of m_text is exceeded.
In my case my linker for the m_text looks like this
m_text (RX) : ORIGIN = 0x00002404, LENGTH = 0x0000FBFC
I would expect that if anything stored in this section goes beyond 0x12000 the linker would generate an error.
If the .text section exceeds the size it triggers and error.
However these two sections also go into flash but do not trigger an error because they are not directly placed into m_text but rather use variables defined in the linker file (__DATA_ROM & __CODE_ROM)
.data : AT(__DATA_ROM)
.code : AT(__CODE_ROM)
How can I get the linker to properly trigger an error?
解決済! 解決策の投稿を見る。
Hi Tom,
Can you add the following line at the end of the linker script? (after line 208)
ASSERT(__CUSTOM_END >= (ORIGIN(m_text) + LENGTH(m_text)), "region m_text overflowed with code and rom data")
This should do the trick.
Best regards,
Rares
Hi Tom,
Can you add the following line at the end of the linker script? (after line 208)
ASSERT(__CUSTOM_END >= (ORIGIN(m_text) + LENGTH(m_text)), "region m_text overflowed with code and rom data")
This should do the trick.
Best regards,
Rares
Hi Rares,
It almost did the trick. The ASSERT happens when the condition is false so I had to flip the greater than to a less than
ASSERT(__CUSTOM_END < (ORIGIN(m_text) + LENGTH(m_text)), "region m_text overflowed with code and rom data")
I would suggest that this gets added to the default linker files that S32 DS generates as others might run into this as well.
Thank you,
Tom
Hi,
I'm not sure about your scenario. By default - when section size is exceeded linker error message is shown:
Can you share your project or .map file?
What's your size output from build console?
Jiri
Hi Jiri,
If I shrink the size of m_text enough I do get the error like you said
However if I make the size big enough for m_text to fit but not big enough for these sections it doesn't give an error
.data : AT(__DATA_ROM)
.code : AT(__CODE_ROM)
Notice if you add the text size to the data size it is 0xACC8 which is larger than I allowed the space to be
From the map file it goes past the allowed space (0x2404 + 0xA000 = 0xC404)
*fill* 0x1fff0ce9 0x3
0x1fff0cec __data_end__ = .
0x0000cca4 __DATA_END = (__DATA_ROM + (__data_end__ - __data_start__))
0x0000cca4 __CODE_ROM = __DATA_END
The generated srecord also shows it going beyond.
S113CCC438BD2B685A1CF2D09847F0E700000240A4