How does host device (IDE: MCUXPresso, KEIL MDK, IAR) pass information to Jlink?

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

How does host device (IDE: MCUXPresso, KEIL MDK, IAR) pass information to Jlink?

Jump to solution
928 Views
mimlo
Contributor III

Hi,
I have recently been involved in making flash loader for iMXRT1176 which uses hyperflash (MIMXRT1176-GEORGE_S26HL512T) over FLEXSPI peripheral.
Unfortunately, the default FlexSPI NOR ROM API seems not to support this version of hyperflash (similar version is present on RT1050-EVKB but it is an older one, CYPRESS S26KS512SDPBHI020) along with my configuration. Despite the fact that pinout used for my hyperflash is identical to the one suggested in the ROM API, but that is issue I handled by implementing my own low level driver for hyperflash and I just don't use the ROM API for FLEXSPI as it does not work.

Now to the point.
I'm trying to figure out this whole jlink related mechanism that takes a bunch of bytes that in a whole is a final application that was previously compiled for the microcontroller which in turn is to be executed from non-volatile memory after power up of the board.

1.) I already know that Jlink is able to download application image to any non-volatile memory (from which code can be executed) only if there is a proper xml device configuration like one below:

 

 

<DataBase>
    <Device>
        <ChipInfo Vendor="NXP" Name="LPC1756" />
        <FlashBankInfo Name="NOR Flash" BaseAddr="0xA0000000">
            <LoaderInfo Name="SPI flash loader" MaxSize="0x01000000" Loader="flash_loader.elf" LoaderType="FLASH_ALGO_TYPE_OPEN" />
        </FlashBankInfo>
    </Device>
</DataBase>

 

 

and on top of that there must exist proper flash_loader.elf that is to be passed into Loader field in the xml device configuration above. This flash_loader.elf must have a proper memory sections defined there code, data and deviceDescription will be placed, like described here:
SEGGER Flash Loader - SEGGER Wiki

 

mimlo_0-1715268321818.png


2.) When one executes image load command via jlink, it loads flash_loader.elf to RAM of the uC and from there it can execute the functions as defined in the OPEN CMSIS FLASH LOADER standard
Algorithm Functions (open-cmsis-pack.github.io)

Now what I lack in understanding is the following.
How does the Jlink or IDE using Jlink pass the chunks of data to the Flash Program function from the CMSIS loader standard above, without any intermediate interface?
flash_loader.elf does not have any main file, so there is no like starting space for code, it must be enforsed somehow to pass the data into the specific functions from API that require it.

I know that MCUXpresso uses something called Mailbox and messages that pass on commands and data, which are defined in a project called LPCXFlashDriverLib where 

void ServiceMessages(Mailbox_t *msg) is defined and according to the description:
 "ServiceMessages.c is flash driver file is intended to function in conjunction with host debug "

Questions:
1.)But how does it work for other IDEs like IAR or KEIL MDK?
2.) How does it work for pure Jlink (used without any IDE) as executed via command line?
3.) Is there some dedicated RAM buffer memory dedicated to storing the data so that no intermediate interface is needed, and the application loaded into RAM can just take the data from that specific RAM memory location placed by Jlink firmware?

Sorry for the long post
Tags (2)
0 Kudos
Reply
1 Solution
628 Views
mimlo
Contributor III

I've just found out on the keil website the following link
Programming External Flash with STM32 Devices (keil.com)

It contains the whole procedure of creating the flash loader for STM32, but it does not really matter for the topic in question.
The essential part that basically explains the procedure was shown on the image below:

mimlo_0-1716364152804.png
For more details, see the link above.

Best regards,
Michal

View solution in original post

2 Replies
629 Views
mimlo
Contributor III

I've just found out on the keil website the following link
Programming External Flash with STM32 Devices (keil.com)

It contains the whole procedure of creating the flash loader for STM32, but it does not really matter for the topic in question.
The essential part that basically explains the procedure was shown on the image below:

mimlo_0-1716364152804.png
For more details, see the link above.

Best regards,
Michal

731 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @mimlo ,

 

I am sorry but as keil and iar are 3rd party tools we don't have such details as you asked, please kindly check with keil and iar for further support. 

https://www.iar.com/knowledge/support/request-technical-support

https://www.keil.com/support/

 

Thanks for your patience and understanding!

 

Have a great day,
Kan


-------------------------------------------------------------------------------
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
Reply