Flash MPC5748g using srec file

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

Flash MPC5748g using srec file

Jump to solution
2,436 Views
developer_newbie
Contributor III

Hello,

I have 2 questions :

1- I'm developping a new bootloader for MPC5748G that I can detect an srec file (application firmware for 3 cores) from SD card and I flash it.

Have you an example or any documentation that explain how can I use information on srec and how can I write them on flash ?

2- When I have mounted the SD card and I don't found the SREC file I need to unmount it and jump to application. My problem consist that the jump does not work when I mount and unmount SD card even uSDHC_DeInit(); is called after unmounting SD.

the execution sequence is like following:

 

 

 

uSDHC_fatfs_initialize();
uSDHC_Init(false); // false : non blocant init
MountSdVolume(); // it call f_mount() function
if(checkSRECfile() == true)
{
//do update
}
UnmountSdVolume();
uSDHC_DeInit(); // in order to reset drv of used device to be able to jump to application
//jump to application
__asm__("e_lis %r12,0x0100");
__asm__("e_or2i %r12,0x0000");
__asm__("mtlr %r12");
__asm__("se_blrl");

 

 

 

 

 

 

0 Kudos
Reply
1 Solution
2,345 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

1. take a look at description of C55FMC_SEL0 - C55FMC_SEL3 registers in the reference manual. These are bit fields which select which block(s) should be erased. I have also this table:

0x00F8C000--0x00F8FFFF - partition 0 - LOCK0/SEL0 bit 15
0x00FC0000--0x00FC7FFF - partition 0 - LOCK0/SEL0 bit 13
0x00FC8000--0x00FCFFFF - partition 0 - LOCK0/SEL0 bit 12
0x00FD0000--0x00FD7FFF - partition 1 - LOCK0/SEL0 bit 11
0x00FD8000--0x00FDFFFF - partition 1 - LOCK0/SEL0 bit 10
0x00FE0000--0x00FEFFFF - partition 0 - LOCK0/SEL0 bit 09
0x00FF0000--0x00FFFFFF - partition 1 - LOCK0/SEL0 bit 07

; Mid address space

0x00F90000--0x00F93FFF - partition 2 - LOCK0/SEL0 bit 31
0x00F94000--0x00F97FFF - partition 2 - LOCK0/SEL0 bit 30
0x00F98000--0x00F9BFFF - partition 2 - LOCK0/SEL0 bit 29
0x00F9C000--0x00F9FFFF - partition 2 - LOCK0/SEL0 bit 28
0x00FA0000--0x00FA3FFF - partition 3 - LOCK0/SEL0 bit 27
0x00FA4000--0x00FA7FFF - partition 3 - LOCK0/SEL0 bit 26
0x00FA8000--0x00FABFFF - partition 3 - LOCK0/SEL0 bit 25
0x00FAC000--0x00FAFFFF - partition 3 - LOCK0/SEL0 bit 24
0x00FB0000--0x00FB7FFF - partition 2 - LOCK0/SEL0 bit 23
0x00FB8000--0x00FBFFFF - partition 3 - LOCK0/SEL0 bit 22

; Large (256k) address space
0x01000000--0x0103FFFF - partition 6 - LOCK2/SEL0 bit 31
0x01040000--0x0107FFFF - partition 6 - LOCK2/SEL0 bit 30
0x01080000--0x010BFFFF - partition 6 - LOCK2/SEL0 bit 29
0x010C0000--0x010FFFFF - partition 6 - LOCK2/SEL0 bit 28
0x01100000--0x0113FFFF - partition 6 - LOCK2/SEL0 bit 27
0x01140000--0x0117FFFF - partition 6 - LOCK2/SEL0 bit 26
0x01180000--0x011BFFFF - partition 6 - LOCK2/SEL0 bit 25
0x011C0000--0x011FFFFF - partition 6 - LOCK2/SEL0 bit 24
0x01200000--0x0123FFFF - partition 7 - LOCK2/SEL0 bit 23
0x01240000--0x0127FFFF - partition 7 - LOCK2/SEL0 bit 22
0x01280000--0x012BFFFF - partition 7 - LOCK2/SEL0 bit 21
0x012C0000--0x012FFFFF - partition 7 - LOCK2/SEL0 bit 20
0x01300000--0x0133FFFF - partition 7 - LOCK2/SEL0 bit 19
0x01340000--0x0137FFFF - partition 7 - LOCK2/SEL0 bit 18
0x01380000--0x013BFFFF - partition 7 - LOCK2/SEL0 bit 17
0x013C0000--0x013FFFFF - partition 7 - LOCK2/SEL0 bit 16
0x01400000--0x0143FFFF - partition 8 - LOCK2/SEL0 bit 15
0x01440000--0x0147FFFF - partition 8 - LOCK2/SEL0 bit 14
0x01480000--0x014BFFFF - partition 8 - LOCK2/SEL0 bit 13
0x014C0000--0x014FFFFF - partition 9 - LOCK2/SEL0 bit 12
0x01500000--0x0153FFFF - partition 9 - LOCK2/SEL0 bit 11
0x01540000--0x0157FFFF - partition 9 - LOCK2/SEL0 bit 10

2. If you have aligned s-record file, it simplifies the code a lot. You do not need to consider alignment and overlapping at all... You can use tool like srec_cat to align the s-record file:

https://srecord.sourceforge.net/

Here is the reason:

lukaszadrapa_0-1669638974755.png

Regards,

Lukas

View solution in original post

0 Kudos
Reply
3 Replies
2,425 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @developer_newbie 

we provide application note AN5319 which shows how to parse s-record file and how to program it to the flash memory. It also shows how to jump to the application:

https://www.nxp.com/docs/en/application-note/AN5319.pdf

https://www.nxp.com/docs/en/application-note-software/AN5319SW.zip

Regards,

Lukas

0 Kudos
Reply
2,390 Views
developer_newbie
Contributor III

Hello @lukaszadrapa ,

Thanks for your answser!

I have 2 more questions about flashing srec file:

1. I don't understand the following parameters : lowBlockSelect , midBlockSelect , highBlockSelect  and n256KBlockSelect ?

Can you explain me what is those parameters and how are they used ? 

2. My Srec file contains only S2 record, is your implementation is valid for my case, I have tried it and I saw, the execution is blocked in the the check of address align. Why you supposed the size of S record is always equal to 16 ? in my case most of S2 record have 0xF4 as size (S2F4....), How should I do in this case ?

Thanks in advance for your support.

0 Kudos
Reply
2,346 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

1. take a look at description of C55FMC_SEL0 - C55FMC_SEL3 registers in the reference manual. These are bit fields which select which block(s) should be erased. I have also this table:

0x00F8C000--0x00F8FFFF - partition 0 - LOCK0/SEL0 bit 15
0x00FC0000--0x00FC7FFF - partition 0 - LOCK0/SEL0 bit 13
0x00FC8000--0x00FCFFFF - partition 0 - LOCK0/SEL0 bit 12
0x00FD0000--0x00FD7FFF - partition 1 - LOCK0/SEL0 bit 11
0x00FD8000--0x00FDFFFF - partition 1 - LOCK0/SEL0 bit 10
0x00FE0000--0x00FEFFFF - partition 0 - LOCK0/SEL0 bit 09
0x00FF0000--0x00FFFFFF - partition 1 - LOCK0/SEL0 bit 07

; Mid address space

0x00F90000--0x00F93FFF - partition 2 - LOCK0/SEL0 bit 31
0x00F94000--0x00F97FFF - partition 2 - LOCK0/SEL0 bit 30
0x00F98000--0x00F9BFFF - partition 2 - LOCK0/SEL0 bit 29
0x00F9C000--0x00F9FFFF - partition 2 - LOCK0/SEL0 bit 28
0x00FA0000--0x00FA3FFF - partition 3 - LOCK0/SEL0 bit 27
0x00FA4000--0x00FA7FFF - partition 3 - LOCK0/SEL0 bit 26
0x00FA8000--0x00FABFFF - partition 3 - LOCK0/SEL0 bit 25
0x00FAC000--0x00FAFFFF - partition 3 - LOCK0/SEL0 bit 24
0x00FB0000--0x00FB7FFF - partition 2 - LOCK0/SEL0 bit 23
0x00FB8000--0x00FBFFFF - partition 3 - LOCK0/SEL0 bit 22

; Large (256k) address space
0x01000000--0x0103FFFF - partition 6 - LOCK2/SEL0 bit 31
0x01040000--0x0107FFFF - partition 6 - LOCK2/SEL0 bit 30
0x01080000--0x010BFFFF - partition 6 - LOCK2/SEL0 bit 29
0x010C0000--0x010FFFFF - partition 6 - LOCK2/SEL0 bit 28
0x01100000--0x0113FFFF - partition 6 - LOCK2/SEL0 bit 27
0x01140000--0x0117FFFF - partition 6 - LOCK2/SEL0 bit 26
0x01180000--0x011BFFFF - partition 6 - LOCK2/SEL0 bit 25
0x011C0000--0x011FFFFF - partition 6 - LOCK2/SEL0 bit 24
0x01200000--0x0123FFFF - partition 7 - LOCK2/SEL0 bit 23
0x01240000--0x0127FFFF - partition 7 - LOCK2/SEL0 bit 22
0x01280000--0x012BFFFF - partition 7 - LOCK2/SEL0 bit 21
0x012C0000--0x012FFFFF - partition 7 - LOCK2/SEL0 bit 20
0x01300000--0x0133FFFF - partition 7 - LOCK2/SEL0 bit 19
0x01340000--0x0137FFFF - partition 7 - LOCK2/SEL0 bit 18
0x01380000--0x013BFFFF - partition 7 - LOCK2/SEL0 bit 17
0x013C0000--0x013FFFFF - partition 7 - LOCK2/SEL0 bit 16
0x01400000--0x0143FFFF - partition 8 - LOCK2/SEL0 bit 15
0x01440000--0x0147FFFF - partition 8 - LOCK2/SEL0 bit 14
0x01480000--0x014BFFFF - partition 8 - LOCK2/SEL0 bit 13
0x014C0000--0x014FFFFF - partition 9 - LOCK2/SEL0 bit 12
0x01500000--0x0153FFFF - partition 9 - LOCK2/SEL0 bit 11
0x01540000--0x0157FFFF - partition 9 - LOCK2/SEL0 bit 10

2. If you have aligned s-record file, it simplifies the code a lot. You do not need to consider alignment and overlapping at all... You can use tool like srec_cat to align the s-record file:

https://srecord.sourceforge.net/

Here is the reason:

lukaszadrapa_0-1669638974755.png

Regards,

Lukas

0 Kudos
Reply