How can I make an application that will be used in another addres of flash ?

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

How can I make an application that will be used in another addres of flash ?

807 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Mon Jun 15 22:20:57 MST 2015
Hi, guys,

I am using LPC1768 and trying to make an application to used it as an apllication joined by my secondary bootloader .
About secondary bottloader I've been seen several topics and I know my secondary bootloader that is using UART is OK.

But I have some problems in my own application ,acually I use IAR Embedded Workbench IDE , and I know by LPCXpresso it's easy to make an application for example for an espesial address and use it.
By compairing these two compliler I found that in LPCXpresso we just to need to go to MCU settings tab and adjust flash location at youe address you want.but in IAR Embedded we should go to linker configuration edit and there are 3 tabs there .in ROM start address I insert my address but as I see I have to change vectore table start in first tab also !!

when I change vector table and ROM start adders ( both ) in same address that I want I see in binarry output file a very stingy amount at the top of this file you can see some 00 00  ... but by LPCXpresso and the top of binary output file is vectores .


Labels (1)
0 Kudos
11 Replies

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Mon Jun 22 22:31:01 MST 2015
Aout that I told my cpu is going to hanking out , that was for a slly mistake and I solved it ,sorry for it.

I removed defenition of  CRP  in linker file and also every place that used of that by " //"   and fortunatly it is working in order I want .

Thanks a lot agin Mike
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Mon Jun 22 07:47:53 MST 2015
I already told you to remove CRP from your link file.
You probably need to remove reference(s) in your source
as the link script is probably autogenerated.

Note that zero in the binary corresponds to the lowest address in the link file.
Progamming, in effect, adds a bias (offest) to the bin file to place it at the
desired location.

As you have a vector table in the code, you must remember to set the NVIC
VTOR register properly to redirect interrupts to your vector table and not to
zero (the base of flash).

How does your bootloader pass control to your app.

There are posts about these considerations; you just have to search for them
yourself!

Cheers, Mike
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Mon Jun 22 02:48:29 MST 2015
Hi every body

first of all when I removed offset of top of binary file and send it as a application it is working but some times it is hanging ! I test this several times by application without secondary bootloader it is ok and I am sure of it .
I focus in that problem and find out at normal binary file second 4byte in file is the address of pc and actulay it refer to the end of file that start by  0xc0 0x46 ......
but at this repaired file ( I removed header offset ) this is not exactly end of file ( some of code that I almost sure it is the point that hank out my cpu is after this point )  

I try to find out what I have to define for crp start and stop but I am not sure .

please some one help me , if you arenot fmilier to IAR please compir it to LPCEXPERSO , as parameter like __CRP start ,....

0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Thu Jun 18 10:08:36 MST 2015
Hi and thanks for your kindy reply ,
I am in vacation today , I will check it  and tell you result soon ,
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Jun 17 11:09:34 MST 2015
I do not have/use IAR so [s]I cannot say why the extra bytes appeared at the top of your file.[/s]

I have a theory.

Your link script calls for the CRP value of FFFFFFFF at 02FC.
Other code is generated for A000.

Note that A000-02FC = 9D04. The exact amount of the extra bytes in the bin file.

IAR outputs FFFFFFFF at 02FC (the lowest address referenced by the link script) and has to pad the
difference (with zeros) to get to A000.

I suggest that you remove the CRP stuff. This application is outside of your bootloader which should have handled the
CRP setting. You do not need to do it twice. [And you delete it in any case by reducing the bin file size.]

Don't you just love simple arithmetic.


Quote:
Now for me it doesn't mater why this offset make but by removing it ,is ok .



But I am the kind of person that really wants to know.  8-)


Cheers, Mike
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Wed Jun 17 01:08:50 MST 2015
Hi Mike ,
I find out if I remove this offset from top of my binary file and make a smaller sized file without that , it is working perfectly . :)

Now for me it doesn't mater why this offset make but by removing it ,is ok .

thanks a lot again and again

0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Jun 16 21:34:24 MST 2015
Thanks agin MIKE,

sorry , I have limited ability in English, especially in writing so I had a mistake .

IAR directly make *.bin for output and I think in LPCEXPRSO you have to gerate *.bin file from *.axf .

I cann't find why this offset make and I want to change it to 0 ,  whould you please tell me how you can make offset in binarry output file by LPCEXOERSO.
pehaps it can help me to find it's in IAR
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Tue Jun 16 06:47:50 MST 2015
As I said, I don't use IAR so I am not familiar with their script file syntax.

I looks OK to me, [Assuming that the various source file are using/defaulting to the identified sections].
Especially '.init vectors' (or whatever it was).

Gentle correction: 'Obesity' means medically over weight  :) I think you meant 'Obviously'.

I am sorry that am not able to help any further with the issue.

EDIT: how did you generate the bin file from the axf -- it could be the conversion that is messing up.

Mike
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Jun 16 06:30:54 MST 2015
Thanks alot MikeSimmonds ,

here is my linker scrip file ,

Obesity I didn't put any offset , but as you mentained I  see a offset in my file .

0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Tue Jun 16 06:00:48 MST 2015
Warning -- I do not use and don't know any IAR details.

However I woud suspect the loader script file -- whether hand written or auto generated.

Your binary 'seems' to have its vector table at offset 09D04 from the start of the file where
the stack pointer is at 10005CA0 (in SRAM) and the reset entry is 12038 (in flash)
Your hard fault etc. vectors point to 0C08A and a vector checksum seems to be present.
[I did not calculate it.]

Perhaps some of these numbers mean something to you.

Beyond that, I did not go.

Perhaps you should upload the linker script.

Mike
0 Kudos

769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Jun 16 03:38:56 MST 2015
In attachment file you can see binary output file for vector addres and ROM address are 0xa000 ( sectore number 10 in lpc1768)

as you can see ( you can open and its contains by winhex or ...)  there is not any relation between 0xa000 and anything in file and also you know the second word in file shoul be reset vector but there it is not clear here.
0 Kudos