Hex file flashing target side

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Hex file flashing target side

3,649 次查看
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.

标签 (1)
0 项奖励
回复
13 回复数

3,603 次查看
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 项奖励
回复

3,600 次查看
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 项奖励
回复

3,591 次查看
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 项奖励
回复

3,587 次查看
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 项奖励
回复

3,581 次查看
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 项奖励
回复

3,475 次查看
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 项奖励
回复

3,445 次查看
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 项奖励
回复

3,585 次查看
yanz
Contributor III

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

0 项奖励
回复

3,627 次查看
vicentegomez
NXP TechSupport
NXP TechSupport

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

 

0 项奖励
回复

3,621 次查看
yanz
Contributor III
What do you mean?
0 项奖励
回复

3,609 次查看
_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 项奖励
回复

3,476 次查看
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 项奖励
回复

3,586 次查看
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 项奖励
回复