Back to basics: Help me use elftosb please

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

Back to basics: Help me use elftosb please

1,232 Views
rshipman
Contributor V

Platform: iMX RT1021

Release package: Flashloader_RT1020_1.0_GA (attached)

(Or from here: https://www.nxp.com/webapp/Download?colCode=Flashloader_RT1020_1.0_GA )

Ubuntu linux terminal running on Windows 10

I am trying to use elftosb to generate a standard flashloader image.

I thought I would try something nice and simple, rather than jumping straight into the encryption stuff (which I tried without success).

I followed the instructions in the document:

Flashloader_RT1020_1.0_GA\doc\i.MX MCU Manufacturing User's Guide.pdf

Under section:

4.2. Generate unsigned normal i.MX MCU bootable image

I created a new folder.

In it I created imx-flexspinor-flashloader-unsigned.bd, containing:

/* From "i.MX MCU Manufacturing User's Guide.pdf" section: 4.2. Generate unsigned normal i.MX MCU bootable image */

/*****************************file start******************************************/

options {

    flags = 0x00;

    startAddress = 0x20000000;

    ivtOffset = 0x400;

    initialLoadSize = 0x2000;

}

sources {

    srecFile = extern(0);

}

section (0)

{

}

/******************************file end *****************************************/

I copied in Flashloader_RT1020_1.0_GA/Tools/elftosb/win/elftosb.exe

I copied in Flashloader_RT1020_1.0_GA/Flashloader/flashloader.srec

I ran:

./elftosb.exe -f imx -V -c imx-flexspinor-flashloader-unsigned.bd -o ivt_flashloader_unsigned.bin flashloader.srec

I get:

        Section: 0x0

The directory listing, after running it:

drwxrwxrwx 1 ronnie ronnie    512 Dec 17 15:39 .

drwxrwxrwx 1 ronnie ronnie    512 Dec 17 15:08 ..

-rwxrwxrwx 1 ronnie ronnie 826880 Dec 17 15:27 elftosb.exe

-rwxrwxrwx 1 ronnie ronnie 150586 Dec 17 15:29 flashloader.srec

-rwxrwxrwx 1 ronnie ronnie    474 Dec 17 15:39 imx-flexspinor-flashloader-unsigned.bd

-rwxrwxrwx 1 ronnie ronnie      0 Dec 17 15:40 ivt_flashloader_unsigned.bin

So ivt_flashloader_unsigned.bin is zero length and there is no corresponding nopadding version.

What is going on please?

Thanks for your help.

Labels (1)
0 Kudos
6 Replies

1,010 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
I think you'd better use the elftosb tool under the linux folder as below shows.

pastedImage_1.png

Have a great day,
TIC

 

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

1,010 Views
rshipman
Contributor V

Thanks for your response.

I am using a Windows 10 machine (on an Intel 64 i7-8665U) - I just use the Ubuntu linux terminal, not the linux operating system (because I prefer it to the windows cmd prompt).

Also under that directory I have just amd64 and i386 folders:

$ ls -la ../../Flashloader_RT1020_1.0_GA/Tools/elftosb/linux
total 0
drwxrwxrwx 1 ronnie ronnie 512 Dec 2 11:34 .
drwxrwxrwx 1 ronnie ronnie 512 Dec 16 15:06 ..
drwxrwxrwx 1 ronnie ronnie 512 Dec 2 11:34 amd64
drwxrwxrwx 1 ronnie ronnie 512 Dec 2 11:34 i386

Which do not match my machine.

So I opened a windows command prompt, to eliminate the linux element.

And run the same elftosb.exe command as the original post.

Same problem. Zero length file:

18/12/2019  09:38                 0 ivt_flashloader_unsigned.bin

I have another question please:

When building an image for use with elftosb, should it be just the application image without any ivt etc? Is that what the flashloader.srec is? No ivt etc? I.e. does that get added by elftosb via the .bd file? How exactly should the image be generated - e.g. linker file settings.

0 Kudos

1,010 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

Thanks for your reply.
1) When building an image for use with elftosb, should it be just the application image without any ivt etc?
-- Yes.
2) Is that what the flashloader.srec is?
-- Yes.
3) Does that get added by elftosb via the .bd file?
-- Yes.
3) How exactly should the image be generated - e.g. linker file settings.
-- Please refer to https://community.nxp.com/docs/DOC-341317
In further, I've done the same testing as you did, and it works well on my PC (Fig 1). So I'd like to suggest you can give a try again on another PC.

pastedImage_1.png

Fig 1

Have a great day,
TIC

 

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

1,010 Views
rshipman
Contributor V

Many thanks. It looks like the only difference between my .bd file and the one you used (imx-dtcm-unsigned.bd). Is the line:

My file:
srecFile = extern(0);

Your file:

elfFile = extern(0);

So even though we are giving elftosb a file ending in .srec, we still need the elfFile variable name. I was just following the document Flashloader_RT1020_1.0_GA\doc\i.MX MCU Manufacturing User's Guide.pdf, which uses srecFile. So it must be wrong.

Anyway it works if I change the variable in my file to be elfFile not srecFile.

Thank you.

0 Kudos

1,010 Views
t_thurgood
Contributor III

Hi

I noticed in your imx-flexspinor-flashloader-unsigned.bd you have...

startAddress = 0x20000000;

This should be 0x60000000 for Arm CM7.

hth,

Tony

0 Kudos

1,010 Views
rshipman
Contributor V

Sorry if you get two replies to this, I seem to have lost one. I'll try again:

Thanks Tony. You are right, if I wanted to put something in flexspinor flash then I would use 0x60000000. Unfortunately the name of my .bd file is wrong. The flashloader lives in internal ram so, I should have called my .bd file something like imx-internalsram-flashloader-unsigned.bd. As it turns out the file recommended by jeremyzhou is called imx-dtcm-unsigned.bd.

0 Kudos