Hello,
I have one custom bootloader located at 0x30000000 till 0x30080000. I compiled it with these addresses.
After that, my main app starts from 0x30800000 till 0x31000000. I compiled my main app with these addresses.
When I compiled my main app:
Automatically generated project_name.debug.ld file in Debug folder does not add below header info to linker file. However if I start my main app with 0x30000000 address, that debug.ld file adds below lines as it should be.
Since I have to use my bootloader, I need to compile my main app with offset address I stated above. Otherwise, if it does not have below lines, my main app does not work.
So, how can I keep below lines in debug.ld file when I compile my app with offset relative to 0x30000000 address? I do not want below lines to be deleted automatically.
Solved! Go to Solution.
Hi @burhanhagi ,
Thank you for your updated information.
I use MCUXPresso IDE generate bootloader and app image separately, then I use JFlash tool to merge bootloader and app image into a hex file.
Please refer Jlink使用技巧之合并烧写文件 - whik - 博客园 (cnblogs.com).
I try to up load my bootloader and app project, but it was limited by exceeding the maximum file size, so I upload the whole project hex file.
hardware: MIMXRT1170-EVKB board
When the sw7 button is pressed the first four times, the LED will light up. When the sw7 button is pressed for the fifth time, the boot loader program will jump to the APP, and the LED light does not need to press the button to flash periodically.
I will show you bootloader critical code. It is just a demo, Please modify and strictly verify according to your needs.
Wish it helps you.
If you still have question about it, please kindly let me know.
Best Regards
mayliu
Hi @burhanhagi ,
Thank you for your interest in the NXP MIMXRT product, I would like to provide service for you.
Please tell me about the IDE you use, if you use MCUXPresso IDE.
Please check the following points:
1: The follows resources will be refreshed after the project is built
2: Window->Preferences->Run/Debug->Launching-> Uncheck it Build(if required) before launching
Wish it helps you.
If you still have question about it, please kindly let me know.
Best Regards
mayliu
Hello @mayliu1,
I did your directives. But it does not help me. Problem still exists.
Here is the SS.
My memory address is below
As I mentioned, when ı give offset address to the origin 0x30000000, IDE deletes the required parts in debug.ld file in Debug Folder as below automatically.
I need the above one in automatic linker file.
My IDE is MCUXpresso v11.8.1
Hi @burhanhagi ,
Thank you for your updated information, I would like to provide service for you.
Please try to set as I show.
Wish it helps you.
If you still have question about it, please kindly let me know.
Best Regards
Hi @mayliu1 ,
I have used it in a way you suggested up to now. That is why I am aware of that for a long time.
However. I have to make everything as automatized with some script files. I need a permanent solution, not manual intervention. Because I will use it in a mass production.
That is why it does not solve my problem.
Hi @burhanhagi ,
I'm sorry for the incorrect understanding of your question before.
section "BOARD_FLASH" is used for boot ROM, It is related to the address 0x30000000 the address, For example ,IVT address is Absolute address.
I think you can refer to MIMXRT1170RM 10.1 Chip-specific Boot Information.
https://www.nxp.com/webapp/Download?colCode=IMXRT1170RM
Your bootloader located at 0x30000000 till 0x30080000. It must need section "BOARD_FLASH".
Your App starts from 0x30800000 till 0x31000000, I think this APP project do not need section "BOARD_FLASH", because if your bootloader start successfully, do some of your logical processing , then will jump to the app 0x30800000.
Wish it helps you.
If you still have question about it, please kindly let me know.
Best Regards
mayliu
@mayliu1 , I faced this kind of problem a while ago. However, as you see in the link, The method suggested there helped me. Now the same debug.ld file causes me to prevent from automating of process. I think there must be an easy method in the below link.
https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/imxrt1176-freertos-linkerscript-file-problem/m-p...
Hi @mayliu1, As I stated before, my app works well. However, without those lines in debug.ld file, my app does not work and enters exception. So I need those lines.
I tried without those lines, even today again, but it not work. So please help me a way how to keep those lines there when I compile my app.
I think there should be a simple method or simple setting in IDE to keep it there. Thanks
Hi @burhanhagi .
Thank you for your updated information, I would like to provide service for you.
I don't think your problem is to set up the MCUXPresso IDE , but to solve the problem of why your APP don't work.
Answer 1:
If you still want setting MCUXPresso IDE to not change xx__Debug.ld, I have shown to you.
.
Answer 2: I use MIMXRT1170-EVKB board, and program bootloader and app project.
The Bootloader address and APP address setting is exactly the same as those you set.
And APP Debug.ld do not have section "BOARD_FLASH".
I can jump to the APP successfully. Please check your Bootloader and app code.
Bootloader:
APP:
Wish it helps you.
If you still have question about it, please kindly let me know.
Hi @mayliu1 ,
How did you load your bootloader code and your main app code to flash? Are you loading them with debugger seperately?
Also when only bootloader is running, are you able to write your main app code to the same flash with yout bootloader? If yes, what is your bootloader code xip_boot_header_enable, xip_external_flash and xip_dcd_header_enable preprocessor flags value? Also what is those flag values in your main app? Which address are you jumping when switch bootloader to main app? After compiled your bootloader code, which address do you start to load your code to Flash? Also after compiled your main app code, which address do you start to load your code to this same Flash?
Can you please upload your bootloader and app source codes as project? Maybe I can see the difference much better if I see the each code and details.
Thanks a lot.
Hi @burhanhagi ,
Thank you for your updated information.
I use MCUXPresso IDE generate bootloader and app image separately, then I use JFlash tool to merge bootloader and app image into a hex file.
Please refer Jlink使用技巧之合并烧写文件 - whik - 博客园 (cnblogs.com).
I try to up load my bootloader and app project, but it was limited by exceeding the maximum file size, so I upload the whole project hex file.
hardware: MIMXRT1170-EVKB board
When the sw7 button is pressed the first four times, the LED will light up. When the sw7 button is pressed for the fifth time, the boot loader program will jump to the APP, and the LED light does not need to press the button to flash periodically.
I will show you bootloader critical code. It is just a demo, Please modify and strictly verify according to your needs.
Wish it helps you.
If you still have question about it, please kindly let me know.
Best Regards
mayliu
Hi @mayliu1,
No need full project codes anymore. The part you shared shows the useful part.
Actually, I had ported already existing codes from ST platform to NXP platform. In ST platforms, I did the same as you shared above when I want to jump APP. However in NXP, the situation has a little bit changed. I reviewed several examples as well as mcuboot_opensource specially example in SDK. It shows there when trying to jump your APP:
0x2000 address offset relative to the first loaded flash base address. So, in our case, 0x30080000 + 0x2000 address is my jump address. At first I surprised because I thought I must have added +4 for ISR Reset Handler. Also I had questioned why 0x2000 offset required? Because this part is only being questioned by on-chip Boot Rom firmware at initial power-up. Anyway, when my codes are running perfect, I do not make any additional steps or consideration. Just admit it was true and OK.
My jump address and yours is different. That is why you do not need the first required boot header info. But I wonder why mcuboot_opensource SDK example explains different than you? Is it possible to review that example? I really wonder where I am missing there.
Thank you very much for your valuable assistance. I will try it on Monday and share the results with you.
Hi @burhanhagi ,
Thank you for your updated information.
I look forward to your good news and thank you for sharing your results with me.
My previous routine settings are based on your settings to verify, if it is different from NXP SDK demo, please use SDK demo as the standard.
Waiting for your good news
Best Regards
mayliu
Hi @mayliu1, @burhanhagi
If possible, please share the Project that linker is modified.
I can't understand the above solution
Hi @KAVIN_M ,
It is not possible to share the project. However, I can share the settings as below;
I have 2 firmware running. First when power enters into the PCB, below settings bootloader is running first;
As you see above, first bootloader is copying itself to the external SDRAM.
When bootloader finishes its job, it runs the main firmware as below;
Lastly, the main firmware begins to execute. Here is its settings;
As you know; linker is automatically created by IDE according to the above settings. So sharing it is the same with linker files.
By the way; in boot firmware the preprocessor flags is as below;
However, in main firmware those flags is as below;
Hope it helps.
You do not need to modify linker files manually. You should leave it as it is created for both. When I first encounter the problem, I took some problems as well because of changing linker files. But not required to change it.
Yes, they are two different projects. I only once write BL to the flash with NXP secure Provisioning Tool. Later than, in IDE I start/stop my main IDE with debugger.
You should not take any fault in any step. If there is, then possible to have some problem with your code elsewhere.