nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
301 stars 136 forks source link

Remove assert from linker files imx7ulp #103

Closed Hadatko closed 1 year ago

Hadatko commented 1 year ago

Signed-off-by: Cervenka Dusan cervenka@acrios.com

Prerequisites

Describe the pull request

It looks like linker files (maybe also for different targets) contains ASSERT which was copied and paste without checking and evaluating its reason. As data section compared with assert are from different memory sections and between them exists another sections which are not checked and it is throwing error even memory sections are not completely used i think this assert should be removed.

Please check also other linker files if you agree with me

Type of change

Tests

Hadatko commented 1 year ago

Here is picture from compiling code with assert: image

Hadatko commented 1 year ago

For example assert for heap and stack make sense to keep as they are located in same memory space (m_data)

Hadatko commented 1 year ago

Matchies: image

mcuxsusan commented 1 year ago

Thank you for the notification and appreciate for your patience, already forwarded the issue to internal team for check.

nxp-wayne commented 1 year ago

Hi Hadatko, The assert here is to ensure the built binary can be accommodated into the flash. Otherwise the application cannot boot from flash. Rationale: Both code and data need to be put into flash (region defined by m_text). If the code + data size exceeds the flash size, the assertion will be triggered and it's an expected behavior.

Hadatko commented 1 year ago

Hi @nxp-wayne, i understand your point. But shouldn't linker itself throw error if m_text would overflow?

Hadatko commented 1 year ago

Hi @nxp-wayne just thinking: If we will do bellow change, we will get linker error. So the result is same without assert. Am i right?

image
Hadatko commented 1 year ago

I will close this PR as it showed up ASSERT is really needed. Thank you.