Discussion Forum

Startup.a51

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Mohammad Adel
Posted
15-Apr-2004 23:52 GMT
Toolset
C51
New! Startup.a51
Is it always important to include the file "startup.a51"?

Should anything else be included for it to work properly?

Thanks
Read-Only
Author
Raj Shetgar
Posted
16-Apr-2004 05:23 GMT
Toolset
C51
New! RE: Startup.a51
Hi,

http://www.keil.com/support/docs/1296.htm

Rgds
Raj Shetgar
Read-Only
Author
Eduard Jadron
Posted
16-Apr-2004 07:51 GMT
Toolset
C51
New! RE: Startup.a51
Yes it is primary init for 51.
Read-Only
Author
Mohammad Adel
Posted
16-Apr-2004 13:15 GMT
Toolset
C51
New! RE: Startup.a51
Is there some detailed explanation of startup.a51?

I read the user's guide but it wasn't much help. I would appreciate it if I can find an example of a startup.a51 modified for custom use.

(I am new to Keil)


Thanks
Read-Only
Author
erik malund
Posted
16-Apr-2004 14:30 GMT
Toolset
C51
New! RE: Startup.a51
Is there some detailed explanation of startup.a51?

WHY?. I used Keil for years and hardly knew it existed. Do you have a SPECIFIC reason for your inquiry?

Erik
Read-Only
Author
Mohammad Adel
Posted
16-Apr-2004 15:03 GMT
Toolset
C51
New! RE: Startup.a51
*Does this mean that iit is not important to use startup.a51?

If so, then in what cases should it be used?

*Or does it mean that it is not important to know its details?


thanks
Read-Only
Author
Frank Hu
Posted
16-Apr-2004 16:35 GMT
Toolset
C51
New! RE: Startup.a51
Hi Mohammad,

I always include startup.a51 in my project. The reasons are:
1. I am using winbond 78E516, and it has an AUX-RAM on the chip. I have to modify the startup.a51 to init this memory area.
2. I want to have a full control of my source code. Even if I don't have to change the startup.a51, I'd prefer to have it included in my project, then I can step through the code before it jump to main. It's useful especially when you have a hardware problem (I mean bad mem W/R).

As to the detail explaination, I think you can read the source code of startup.a51, It's kind of self-explained to me.

Have a nice day!
Frank
Read-Only
Author
Mohammad Adel
Posted
16-Apr-2004 17:59 GMT
Toolset
C51
New! RE: Startup.a51
Thanks Frank..
The problem with the file is that i am not that good at assembly.

I can understand the codes that clear memory, but other parts seem rather ambigous
Read-Only
Author
erik malund
Posted
16-Apr-2004 17:05 GMT
Toolset
C51
New! RE: Startup.a51
1)Does this mean that iit is not important to use startup.a51?
2)Or does it mean that it is not important to know its details?

1) it is not "important" it is REQUIRED if you have any C code.
2) I did not know the details for years, never looked.

Erik
Read-Only
Author
Mohammad Adel
Posted
16-Apr-2004 18:00 GMT
Toolset
C51
New! RE: Startup.a51
Thanks...
Read-Only
Author
Drew Davis
Posted
17-Apr-2004 04:34 GMT
Toolset
C51
New! RE: Startup.a51
I can understand the codes that clear memory, but other parts seem rather ambigous

As a public service, here are the parts of the standard Keil-supplied STARTUP.A51 that do not involve clearing memory.

                CSEG    AT      0
?C_STARTUP:     LJMP    STARTUP1

The 8051 always begins execution at address 0, which is also the beginning of the interrupt vector table. This code makes the startup vector jump to the startup code located at STARTUP1.

(Much memory initialization deleted...)

                MOV     SP,#?STACK-1

This code initializes the stack pointer to point at the stack segment defined to hold the stack.

; This code is required if you use L51_BANK.A51 with Banking Mode 4
; EXTRN CODE (?B_SWITCH0)
;               CALL    ?B_SWITCH0      ; init bank mechanism to code bank 0

This code is required if you use L51_BANK with banking mode 4 to do bank switching. It initializes the bank switching mechanism to start off in bank 0. If you're not doing this, leave the call commented out.

                LJMP    ?C_START

This code jumps to the start of your C code -- that is, main().

                END

And that's it. Not much in there at all.

You'll often want to modify STARTUP.A51 when you have an 8051 variant with nifty optional features like built-in memories or banking or peripherals that require some initialization of chip-specific registers.
Read-Only
Author
Mohammad Adel
Posted
21-Apr-2004 01:16 GMT
Toolset
C51
New! RE: Startup.a51
Thanks...
Read-Only
Author
Andrew Neil
Posted
21-Apr-2004 06:48 GMT
Toolset
C51
New! RE: Startup.a51
                LJMP    ?C_START
This code jumps to the start of your C code -- that is, main().


Not quite.

C_START is the start of Keil's 'C' runtime startup: this includes, among other things, the code to setup all the values of initialised variables.
Once this code has completed, it then jumps to main().

As someone else mentioned earlier, you can step through all this if you want...

Next Thread | Thread List | Previous Thread Start a Thread | Settings