nxp-mcuxpresso / sbl

Other
39 stars 10 forks source link

generating app image example #3

Closed mafekam314 closed 2 years ago

mafekam314 commented 2 years ago

Hello,

So I tried to compile an example image (led blink) with arm gcc tool. I used the "MIMXRT1021xxxxx_flexspi_nor.ld" linker file

I modifed it from /* Specify the memory areas */ MEMORY { m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000 m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000 m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400 m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x007FDC00 m_qacode (RX) : ORIGIN = 0x00000000, LENGTH = 0x00010000 m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00020000 }

to /* Specify the memory areas */ MEMORY { m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000 m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000 m_interrupts (RX) : ORIGIN = 0x60100400, LENGTH = 0x00000400 m_text (RX) : ORIGIN = 0x60100800, LENGTH = 0x007FDC00 m_qacode (RX) : ORIGIN = 0x00000000, LENGTH = 0x00010000 m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00020000 }

but its not workig. I tried to follow the sbl doc MCUOTASBLSFWUG.pdf but its not clear how to modify the "MIMXRT1021xxxxx_flexspi_nor.ld" image to make it work.

could you help me please ?

Tim-Wang38 commented 2 years ago

Hello,

So I tried to compile an example image (led blink) with arm gcc tool. I used the "MIMXRT1021xxxxx_flexspi_nor.ld" linker file

I modifed it from /* Specify the memory areas */ MEMORY { m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000 m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000 m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400 m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x007FDC00 m_qacode (RX) : ORIGIN = 0x00000000, LENGTH = 0x00010000 m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00020000 }

to /* Specify the memory areas */ MEMORY { m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000 m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000 m_interrupts (RX) : ORIGIN = 0x60100400, LENGTH = 0x00000400 m_text (RX) : ORIGIN = 0x60100800, LENGTH = 0x007FDC00 m_qacode (RX) : ORIGIN = 0x00000000, LENGTH = 0x00010000 m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00020000 }

but its not workig. I tried to follow the sbl doc MCUOTASBLSFWUG.pdf but its not clear how to modify the "MIMXRT1021xxxxx_flexspi_nor.ld" image to make it work.

could you help me please ?

Did you use the imgtool to add the image header?

mafekam314 commented 2 years ago

no I didn't use imgtool becasue I thought image tools used only for secured encrypted image. I need a simple image just to see sbl bootloader is wokring.

Tim-Wang38 commented 2 years ago

no I didn't use imgtool becasue I thought image tools used only for secured encrypted image. I need a simple image just to see sbl bootloader is wokring.

The single image mode also need to verify the signature and the image header also contain some other information that the SBL need.

mafekam314 commented 2 years ago

I am confused, so can you tell me what are the steps to follow to create a boot image ?

Tim-Wang38 commented 2 years ago

I am confused, so can you tell me what are the steps to follow to create a boot image ?

I think chapter7.2 of the UG is clear enough. You just need to step by step.

mafekam314 commented 2 years ago

First, to make space for adding a header later, change the linker file. The default application offset address is 0x100000, modify the linker to adapt to this address, the IAR linker of EVKMIMXRT1060 in the picture below can be used for reference. Remove the XIP header information by set XIP_BOOT_HEADER_ENABLE = 0 in iar project option, and then compile the project and generate a binary file named hello_world.bin.

but as you can see it explain using the IAR linker but I don't have IAR and I am using GCC arm tools with MIMXRT1021xxxxx_flexspi_nor.ld linker

can you please explain to me how I do this with the gcc linker ?

mafekam314 commented 2 years ago

so i tried to follow the doc and I did use the imgtool but still it doesn't work I got this message from sbl bootloader

h e l l o   s b l . 
B o o t l o a d e r   V e r s i o n   1 . 1 . 0 
B o o t l o a d e r   c h a i n l o a d   a d d r e s s   o f f s e t :   0 x 1 0 0 0 0 0 
R e s e t _ H a n d l e r   a d d r e s s   o f f s e t :   0 x 1 0 0 4 0 0 
J u m p i n g   t o   t h e   i m a g e 

h e l l o   s b l . 
B o o t l o a d e r   V e r s i o n   1 . 1 . 0 
B o o t l o a d e r   c h a i n l o a d   a d d r e s s   o f f s e t :   0 x 1 0 0 0 0 0 
R e s e t _ H a n d l e r   a d d r e s s   o f f s e t :   0 x 1 0 0 4 0 0 
J u m p i n g   t o   t h e   i m a g e 

it say jumping but the app doesn't start I think there is a problem with the linker file please help ?

Tim-Wang38 commented 2 years ago

First, to make space for adding a header later, change the linker file. The default application offset address is 0x100000, modify the linker to adapt to this address, the IAR linker of EVKMIMXRT1060 in the picture below can be used for reference. Remove the XIP header information by set XIP_BOOT_HEADER_ENABLE = 0 in iar project option, and then compile the project and generate a binary file named hello_world.bin.

but as you can see it explain using the IAR linker but I don't have IAR and I am using GCC arm tools with MIMXRT1021xxxxx_flexspi_nor.ld linker

can you please explain to me how I do this with the gcc linker ?

You can refer to the .MIMXRT1021xxxxx_flexspi_nor_cpp.ld in sfw\target\evkmimxrt1020\board\link\ which will be generated when ýou use gcc to compile the SFW.

mafekam314 commented 2 years ago

@Tim-Wang38 thank you I will try and let you know

mafekam314 commented 2 years ago

@Tim-Wang38 now its working. thank you for your support