Hex file flashing target side

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

Hex file flashing target side

2,285 Views
yanz
Contributor III

Hello,

I'm trying to flash hex file into into Flexspi flash as a secondary application (the first one is bootloader that actually should flash a hex).

I'm a little bit disappointed with the addresses, for example  the first line of hex file is

:020000042000DA

and a Linear Address is 0x20000000.

How do I translate this into flash offset (let's say 0x40000)?

Is there any sample of hex file record parsing and flashing?

Thank you in advance.

Labels (1)
0 Kudos
13 Replies

2,239 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @yanz ,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Firstly, I'd like to know whether you can introduce the source of the HEX file, next, the HEX should be converted into a BIN file prior to being programmed to the flash, for the i.MX RT series MCU, you can use the tool to do convert job.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,236 Views
yanz
Contributor III

Thank you for your response.

Out team is working with MCUExpresso IDE.

  1. How do I change a HEX file offset so it can be flashed into different well known location and can be loaded by bootloader (bootable application (bootloader) loads up from well-known location another application (burned from HEX file)). For example, I want to create an HEX file and (using my own code) burn it with offset of 512K from the flash start. I know that HEX file is compiled to be burned into specific location.
  2. Is HEX file above that burned into well-known location  must be bootable?I guess that not, but if somebody may answer it could be fine.

 

0 Kudos

2,227 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @yanz ,
Thanks for your reply, even though I'm still not very clear about your purpose.
1) According to your statement, you want to know the steps of generating the HEX file with a specific offset from the flash start address, if my understanding is right, you can follow the below steps to do it.
1) Modify the memory map;
2) Then build the demo again to generate the AXF file;
3) Last, generate the HEX file just as the figure shows.

 

jeremyzhou_1-1663813402870.png

2) Is HEX file above that burned into well-known location  must be bootable?
-- It depends on the type of MCU, so what MCU do you use?Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,223 Views
yanz
Contributor III

Thank for your response.

1. How do I modify memory map? - this info is unclear for me.

2. We're using imxrt1050.

 

0 Kudos

2,217 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @yanz ,
Thanks for your reply.
My mean is you should modify the linker file if you want the image to have a specific offset from the flash start address, so please refer to the user guide of the MCUXpresso to do it.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,111 Views
yanz
Contributor III

I have my own bootloader (bootable application on external flash, burned with MCU boot utility, loads up and works). Bootloader is HID USB app that's communicating with the host application. Host parses .hex file and sends the data to bootloader for flashing (or jumping to previously flashed file). Hex file generated from evkbimxrt1050_flash_component_nor sample and has no flash in his memory map. Hex file has the following extended address:

:020000042000DA (2000 is an upper 16 bit in address). After parsing, I have Programming Address Hex:0x20002000 and it doesn't match any flash address or offset.

I want to flash hex file to BOOT_FLASH_CAND_APP. How do I deal with Hex:0x20002000? Ignore? Translate? Any other definition in project settings that will lead to desired flash offset?

#define BOOT_FLASH_BASE 0x60000000
#define BOOT_FLASH_ACT_APP 0x60040000
#define BOOT_FLASH_CAND_APP 0x60240000

#define FLASH_AREA_IMAGE_1_OFFSET (BOOT_FLASH_ACT_APP - BOOT_FLASH_BASE)
#define FLASH_AREA_IMAGE_1_SIZE (BOOT_FLASH_CAND_APP - BOOT_FLASH_ACT_APP)
#define FLASH_AREA_IMAGE_2_OFFSET (FLASH_AREA_IMAGE_1_OFFSET + FLASH_AREA_IMAGE_1_SIZE)
#define FLASH_AREA_IMAGE_2_SIZE FLASH_AREA_IMAGE_1_SIZE // image2 slot is the same size as image1
#define FLASH_AREA_IMAGE_3_OFFSET (FLASH_AREA_IMAGE_2_OFFSET + FLASH_AREA_IMAGE_2_SIZE)

0 Kudos

2,081 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Any other definition in project settings that will lead to desired flash offset?
-- Please refer to the link to generate the image that should reside in the external nor flash.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

2,221 Views
yanz
Contributor III

Note that external flash is used (not in memory map).

0 Kudos

2,263 Views
vicentegomez
NXP TechSupport
NXP TechSupport

Would be possible that you tell us the part number that is used?

 

0 Kudos

2,257 Views
yanz
Contributor III
What do you mean?
0 Kudos

2,245 Views
_Leo_
NXP TechSupport
NXP TechSupport

Is the imxrt500 the device that you are using?

Can you share with us in more detail about your problem?

 

0 Kudos

2,112 Views
yanz
Contributor III

Sure.

I have my own bootloader (bootable application on external flash, burned with MCU boot utility, loads up and works). Bootloader is HID USB app that's communicating with the host application. Host parses .hex file and sends the data to bootloader for flashing (or jumping to previously flashed file). Hex file generated from evkbimxrt1050_flash_component_nor sample and has no flash in his memory map. Hex file has the following extended address:

:020000042000DA (2000 is an upper 16 bit in address). After parsing, I have Programming Address Hex:0x20002000 and it doesn't match any flash address or offset.

I want to flash hex file to BOOT_FLASH_CAND_APP. How do I deal with Hex:0x20002000? Ignore? Translate? Any other definition in project settings that will lead to desired flash offset?

#define BOOT_FLASH_BASE 0x60000000
#define BOOT_FLASH_ACT_APP 0x60040000
#define BOOT_FLASH_CAND_APP 0x60240000

#define FLASH_AREA_IMAGE_1_OFFSET (BOOT_FLASH_ACT_APP - BOOT_FLASH_BASE)
#define FLASH_AREA_IMAGE_1_SIZE (BOOT_FLASH_CAND_APP - BOOT_FLASH_ACT_APP)
#define FLASH_AREA_IMAGE_2_OFFSET (FLASH_AREA_IMAGE_1_OFFSET + FLASH_AREA_IMAGE_1_SIZE)
#define FLASH_AREA_IMAGE_2_SIZE FLASH_AREA_IMAGE_1_SIZE // image2 slot is the same size as image1
#define FLASH_AREA_IMAGE_3_OFFSET (FLASH_AREA_IMAGE_2_OFFSET + FLASH_AREA_IMAGE_2_SIZE)

 

 

 

0 Kudos

2,222 Views
yanz
Contributor III

Thank for your response.

The problem is described above.

1. How do I modify memory map? - this info is unclear for me.

2. We're using imxrt1050.

 

0 Kudos