Monday, January 22nd 2018, 10:44am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

MatthewKyeo

Beginner

Date of registration: Jul 19th 2017

Posts: 49

1

Sunday, October 15th 2017, 2:09pm

[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








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

This post has been edited 3 times, last edit by "MatthewKyeo" (Oct 15th 2017, 2:17pm)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 567

2

Tuesday, October 17th 2017, 10:57am

Hello Matthew,

Quoted

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.

Quoted

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

MatthewKyeo

Beginner

Date of registration: Jul 19th 2017

Posts: 49

3

Thursday, October 19th 2017, 10:06am

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.





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

SEGGER - Johannes

Super Moderator

Date of registration: Aug 31st 2012

Posts: 376

4

Thursday, October 19th 2017, 3:22pm

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

MatthewKyeo

Beginner

Date of registration: Jul 19th 2017

Posts: 49

5

Tuesday, October 24th 2017, 8:56am

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

This post has been edited 1 times, last edit by "MatthewKyeo" (Oct 24th 2017, 8:58am)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 567

6

Tuesday, October 24th 2017, 9:06am

Hi Matthew,

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

Best regards,
Nino