Cannot convert ELF to S-record error with tool v6

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

Cannot convert ELF to S-record error with tool v6

Jump to solution
1,884 Views
jan_visser
Contributor II

Hi,

I'm developing an application on a RT1062 using Keil microvision.

The application code and data are in DRAM. I use the secure provisioning tool to generate a bin file that can be flashed. I provide a custom dcd.bin file for the provisioning tool.

 

Recently I made a change to my program: I changed the scatter file to store one of the object files in the uncached part of the DRAM. Since I made this change the provisioning tool reports the following error when trying to build an image:

"Cannot convert ELF to S-Record. Make sure the ELF includes the symbol table and rebuild the image"

I'm using provisioning tool version 6

My program does run if I load it into DRAM with the debugger, so I don't understand why the provisioning tool should give this error.

0 Kudos
1 Solution
1,783 Views
jan_visser
Contributor II

Hi Marek,

Thanks for your response. I will use the HEX file from now on. It is important to me that I have a confirmation that the error messages are not caused by a fault in my programming.

 

Regards,

Jan

View solution in original post

0 Kudos
6 Replies
1,846 Views
jan_visser
Contributor II

Hi Marek,

I tried converting the file from HEX. It worked and I can now upload and run the bin file on my target. I'll give you the scatter file in a moment.

Regards,

Jan

0 Kudos
1,864 Views
marek-trmac
NXP Employee
NXP Employee

Hi Jan,

can you provide scatter file so we can reproduce the issue on our side and analyze?

In the mean time, can you try to convert application binary into S-record or HEX file or raw binary (In Project > Options > Output Converter, check Generate additional output). And then try to use this file as an input in SEC tool?

Regards,
Marek
0 Kudos
1,844 Views
jan_visser
Contributor II

Hi Marek

I've attached the scatter file to this post. The file extention was changed from .scf to .txt because the forum upload tool does not recognize the .scf extention.

The error is triggered by line 102. After I added that line, the tool gave an error message when processing the .out file created by Keil microvision.

 

I also tried to create a .bin file by calling transform_image_win.bat and buid_image_win.bat from the command line. If I do that, it generates a 31 megabyte .bin, which is exactly the size of the SDRAM.

Best regards,

Jan

 

1,801 Views
jan_visser
Contributor II

I have experimented further and I am seeing some very odd things.

I took my project from my first post in this thread and removed the line that was causing an error from the scatter file because I needed to continue with the project.

Then I added some code at the end of main.c to catch an exception.

void UsageFault_Handler(void)
{
PRINTF("UsageFault \n");
while(1);
}

After adding this code, the provisioning tool reports the following error:

"Cannot parse SREC image converted from ELF. Details: data added to a segment must be adjacent to or overlapping with the original segment data"

The error is somehow related to how data and code are stored in the image. If I make the string in the PRINTF statement longer or shorter, the message dissapears.

The memory organization in my project seems to be causing problems, but as far as I can see I'm not trying to do anything out of the ordinary.

 

Is there anything with regard to memory organization that I need to be aware of when using the provisioning tool?

Best regards,

Jan

0 Kudos
1,798 Views
marek-trmac
NXP Employee
NXP Employee

Hi Jan,

the root cause of the first problem is in the ELF conversion into S-RECord. The conversion works for code blocks, that are continuously located in one memory, but does not work for code blocks located on different addresses. 

MDK has an option to create output in HEX format (see my previous response) and you have already confirmed HEX file works on your side. Can you turn on the conversion to HEX and continue using HEX? I believe this should work for you.

HEX file is supported as valid input format in MCUXpresso Secure Provisioning tool.

Hope this helps.

Regards,
Marek
0 Kudos
1,784 Views
jan_visser
Contributor II

Hi Marek,

Thanks for your response. I will use the HEX file from now on. It is important to me that I have a confirmation that the error messages are not caused by a fault in my programming.

 

Regards,

Jan

0 Kudos