IN THE KNOW
Go to bottomPage: 1
TOPIC:
#956
Boot loader for the Z8F082A 1 Year, 3 Months ago Karma: 0
Hi sir,
The boot loader is used the reset pin to entry the code.
But how to entry the boot loader from the user's application code ?

Thanks,

Eric
eric (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#958
Re:Boot loader for the Z8F082A 1 Year, 2 Months ago Karma: 4
Hi Eric,
I am unclear which MCU and bootloader you are using.
Check out Application note AN0333, this discusses calling C functions from Assembly and Vice Versa.
The easiest way is to add a tag to the assembly with the leading underscore and call it from C (you will need to add the prototype function without the leading underscore).
Example (assuming there are no parameters):
Code:


Assembly code:
_MyBootLoaderFunction:

In the C file:

 Void MyBootLoaderFunction();




Then you can call it like any C function.

You can also use inline assembly to jump to the tag or address directly.
Tom Ormiston (Admin)
Admin
Posts: 168
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#959
Re:Boot loader for the Z8F082A 1 Year, 2 Months ago Karma: 0
Hi Tom,
Thanks. We are using the Z8F082 sereis, try to merge our application code with bootloader code (AN0328-SC01) in same project.
Now, the problem is after the boot loarder finished, the program will jump to the application code. But don't know where's the entry point.
Is possible define the code segment with fixed address in our application code ( C programs) ?

Regards,

Eric
eric (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#961
Re:Boot loader for the Z8F082A 1 Year, 2 Months ago Karma: 4
Eric
The address of the application code is always at the reset vector (0x002).
The Bootloader code is assign with the fixed address 0x1C00 here:

DEFINE CODESEG, SPACE = ROM, ORG = 7168 ; 07168 = 1C00h Bootloader code address

The bootloader looks for the address 0x0002 and 0x0003 in the hex file and stores this address as the pointer to the start of the application.
When there is no space bar on entry, the bootloader calls that address to start the application.

If I understand correctly, you are trying to combine both your app and the bootloader app together, to provide a starting point, on which the application can be updated in the field.

To make this work, you will need to have 2 different applications.
Base application (without bootloader) with the standard startup.asm file. This file is what would be flashed via the bootloader in the field.

On the application with the bootloader, you will need to modify the startup.asm file:
The line:
VECTOR reset=_c_startup
needs to be commented out (so there is no reset vector added, already defined in the Bootloader code)
and put the address of _c_startup into the address location the bootloader calls for the application (probably 0x1BFC).
Tom Ormiston (Admin)
Admin
Posts: 168
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1