How to fill unused flash in S32DS?

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

How to fill unused flash in S32DS?

Jump to solution
2,675 Views
cthhk
NXP Employee
NXP Employee

Dear Team:

I'm using S32DS ARM v1.3 and I want to fill the unused flash area with some const. Could you give me an example?

I have tried similar "FILL" operation on Codewarrior but it seems that the GNU linker does not work in a similar way.

Appreciate your support!

Best Regards,

Wang

Labels (1)
1 Solution
2,257 Views
BlackNight
NXP Employee
NXP Employee

Hi Wang,

the following article describes how to do this with the GNU linker:

FILLing unused Memory with the GNU Linker | MCU on Eclipse 

I hope this helps,

Erich

View solution in original post

0 Kudos
6 Replies
2,258 Views
BlackNight
NXP Employee
NXP Employee

Hi Wang,

the following article describes how to do this with the GNU linker:

FILLing unused Memory with the GNU Linker | MCU on Eclipse 

I hope this helps,

Erich

0 Kudos
2,256 Views
cthhk
NXP Employee
NXP Employee

Hi Erich:

I'm a big fan of your blog. :smileyhappy:

Actually your example is based on Codewarrior 10, and I have tried your setup in my S32DS project but I got some "syntax error" regarding the "FILL" statement.

And I also tried something like " section {} > memory_segment = 0xFF" in linker file, but nothing happened to the generated srec file.

Could you help to build an example under S32DS? 

Thanks a lot!

Best Regards,

Wang

0 Kudos
2,256 Views
martin_kovar
NXP Employee
NXP Employee

Hello Wang,

I found simple solution. It looks very similar to solution which posted Erich above. Please see the following link:

http://www.microchip.com/forums/m555060.aspx 

Regards,

Martin

0 Kudos
2,256 Views
cthhk
NXP Employee
NXP Employee

Hello Martin:

Now it works. Thank you. :smileyhappy:

Best Regards,

Wang

2,256 Views
BlackNight
NXP Employee
NXP Employee

Hi Wang,

thank you :-).

The same principle applies as well to S32DS, as it uses the GNU linker as well. the only difference is that in the S32DS the memory sections are named differently.

I tried it quickly in the S32DS, and it worked fine (project attached).

in the linker file I have changed/added

  .fini_array :
  {
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT(.fini_array.*)))
    KEEP (*(.fini_array*))
    /* PROVIDE_HIDDEN (__fini_array_end = .); */
  } > FLASH_2

   .fill :
  {
    FILL(0xDEADBEEF);
    . = ORIGIN(FLASH_2) + LENGTH(FLASH_2) - 1;
    BYTE(0xAA)
    ___ROM_AT = .;
    PROVIDE_HIDDEN (__fini_array_end = .);
  } > FLASH_2

I hope this helps,

Erich

0 Kudos
2,256 Views
cthhk
NXP Employee
NXP Employee

Hi Erich:

Now I see the dead beef. :smileyhappy:

The lesson learn is, when disclaim a section, don't forget to put a space between the section name and the comma. In other words, ".fill :" works good, but ".fill:" will cause a syntax error.

Happy spacing. :smileyhappy:

0 Kudos