[SOLVED] How to make the linker write binary values in a flash memory using SES

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] How to make the linker write binary values in a flash memory using SES

    Hi, I'm Matthew. I use

    - 64-bit SES 3.26 on 64-bit Windows 10

    - J-Link Plus or onboard J-Link (Nordic's dev kits have a J-Link on the board itself)

    - J-Link 6.16h

    - Nordic's PCA10040 v1.1.1 board (this board uses nRF52832-QFAA MCU)

    - STM32F4 Discovery board


    In the past, I used IAR EWARM 7 and Keil MDK 5.


    IAR EWARM provides features like

    - link one binary file of any kind (e.g. bin, bmp, wav, etc.) in a project through the linker option

    - program binary file(s) into flash

    [img]http://www.epnc.co.kr/news/photo/201508/51588_51234_10.jpg[/img]


    [img]http://www.epnc.co.kr/news/photo/201508/51588_51238_14.jpg[/img]



    I used the second feature frequently to flash a wav file into the STM32F4 MCU to test ST's Audio playing project .

    In the past, I used IAR EWARM 7, the STM32F4 MCU and the J-Link Edu to flash the wave file.

    Now, I have migrated to SES 3.26 and I have to flash wav file again with SES and J-Link Plus.

    1. How can I flash a wav file with SES?

    If it is not possible to flash it with SES, what else can I use, such as J-Flash?

    2. After compiling and building a project, a hex file is created.

    Does that hex file contains the wav file?

    I would like to have that wav file inside the hex file after the project is built.

    -Best Regards
    -Best Regards, Matthew

    The post was edited 3 times, last by MatthewKyeo ().

  • Hello Matthew,

    1. How can I flash a wav file with SES?

    You have two options here.
    1. You set the wav file as an additional load fiel. To do so go to project options -> Debug->Loader here you edit Additional Load file [0] , type and address.
    Now the wav file should be downloaded into the mentioned address.
    2. For full control we recommend using our free tool Bin2C and convert the wav file into a C-array that you can include in your project so you have complete control on how to use it and where it gets placed etc.

    2. After compiling and building a project, a hex file is created.

    Does that hex file contains the wav file?

    The hex file will only contain the wav file if you choose option 2.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • SEGGER - Nino wrote:

    You have two options here.
    1. You set the wav file as an additional load fiel. To do so go to project options -> Debug->Loader here you edit Additional Load file [0] , type and address.
    Thanks. Then let's consider the Nordic's MCU case.

    [img]https://i.stack.imgur.com/3vOB0.jpg[/img]



    Nordic loads a hex image called SoftDevice. I use SoftDevice 5.0 . So I already filled a directory at the "Additional Load file [0]" field.

    According to from the specification,

    The SoftDevice Flash Region is located between addresses 0x00000000 and APP_CODE_BASE - 1 and is occupied by the SoftDevice.


    The Application Flash Region is located between the addresses APP_CODE_BASE and the last valid address in the flash memory and is available to the application.

    SoftDevice size = 136KB, APP_CODE_BASE address (absolute value) = 0x00023000

    Considering the size of the SoftDevice, should I type my wav file directory in the "Additional Load File[1]" when working with the Nordic's MCU?

    I'm concerned that both wav file and the SoftDevice hex file might overwrite each other while loading.

    Do I have to configure other variables such as load file address?

    -Best Regards
    -Best Regards, Matthew
  • Hi,

    Of course your wav file should not overwrite any other part of your system, so you would usually place it after your applicaiton code.
    Since you are probably going to access it from your application, you should know where to put it.

    Correct, you add it as Additional Load File[1], set the type to bin and enter the start address where to load it.

    Regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thanks to you both! Here's my result. I have used a JPG file instead of a WAV file.

    First, I checked the memory size and usage not to overlap my binary file.




    So I configured the load file after checking the memory usage.




    After flashing the MCU with the J-Link, the memory viewer shows the correct values! I used HxD to check the binary values.




    Case solved! Thanks1

    -Best Regards
    -Best Regards, Matthew

    The post was edited 1 time, last by MatthewKyeo ().

  • Hi Matthew,

    Great to hear that you are up and running.
    I will consider this case as solved.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.