fill 0x00 to the user flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fill 0x00 to the user flash

Jump to solution
3,782 Views
oceansea
Contributor III

hi,

i use the S32K MCU,and i set generate bin file ,it's 70kB(addr is 0~0x117FF)

but i want to fill 0x00 to  the addr  0x11800~0x11fff,  because i need set checksum .

how to set  auto fill the bin file?

Labels (1)
0 Kudos
Reply
1 Solution
3,561 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm not sure what's wrong with your project - but on my side is everything working okay - I used S32K148 and your address range. Here is S-Record: 

pastedImage_1.png

And here raw binary file (0x3F000 - 0x20000 - binary file starts always from 0x00000000):

pastedImage_3.png

I forgot mention that for raw binary file you also need to fill by 0x00  unused m_text section. Binary doesn't contain addresses and your 0x00 part starts right after last program instruction. Thats why bin file has 128k and s-record only 29k. So,  just add into last m_text entry: 

pastedImage_4.png

Hope it helps. 

Jiri 

View solution in original post

0 Kudos
Reply
6 Replies
3,561 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can modify linker file for that and define for example m_fill memory area and .fill section: 

pastedImage_1.png

pastedImage_2.png

In attachment is an example. Hope it helps. 

Jiri 

0 Kudos
Reply
3,561 Views
oceansea
Contributor III

hi ,thanks reply 

i do follow your idea, but it can't hanve a perfect  result, i do this 

pastedImage_1.png

pastedImage_6.png

because my prj is app ,it has a bootloader jump to here. so my start addr not 0x00000000,

is 0x20000.And then i generater the bin file 

pastedImage_2.png

the end addr is 0x20DDB, i think ,

my start is 0x20000,and the m_text start addr is 0x20410,lenth is 0x1EBF0, so 

the app end addr is 0x3EFFF.Then ,the m_fill start addr is 0x3F000,lenth is

0x1000, and the file end addr should be 0x40000.   Because my app file start is 

0x20000,not 0 ,so the file end addr should be (0x40000-0x20000)=0x20000.

My  MCU is S32K148 

0 Kudos
Reply
3,562 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm not sure what's wrong with your project - but on my side is everything working okay - I used S32K148 and your address range. Here is S-Record: 

pastedImage_1.png

And here raw binary file (0x3F000 - 0x20000 - binary file starts always from 0x00000000):

pastedImage_3.png

I forgot mention that for raw binary file you also need to fill by 0x00  unused m_text section. Binary doesn't contain addresses and your 0x00 part starts right after last program instruction. Thats why bin file has 128k and s-record only 29k. So,  just add into last m_text entry: 

pastedImage_4.png

Hope it helps. 

Jiri 

0 Kudos
Reply
3,561 Views
oceansea
Contributor III

hi ,now i use a new problem ,i use the same solution  in the S32K146, 

it show this pastedImage_1.png

it generate  the bin file over 128k byte  and the accessory is my ld file  ,my IDE is 

S32 Design Studio for ARM Version 2018.R1

pastedImage_2.png

pastedImage_3.png

0 Kudos
Reply
3,561 Views
oceansea
Contributor III

HI,

thanks reply ,is perfect solve my problem.

But i don't  about __ROM_AT = .;

can you tell me ?

0 Kudos
Reply
3,561 Views
jiri_kral
NXP Employee
NXP Employee

Hi,

 

I took this part from another thread and originally it is from Erich Styger's blog - FILLing unused Memory with the GNU Linker | MCU on Eclipse  - as he said - some Linkers/startup code needs this symbol to be defined. For S32DS for ARM  v2018.R1 - you can remove it. 

Jiri

0 Kudos
Reply