Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Function Location in Keil 8051 [Resolved]

Status
Not open for further replies.

CMOS

Advanced Member level 3
Joined
Jan 6, 2004
Messages
862
Helped
94
Reputation
186
Reaction score
50
Trophy points
1,308
Location
USA
Activity points
5,673
How do I place a function to a specific location in code memroy like using "ORG" directive in assembly?? I am using Keil 8051 Compiler.
 

Re: Function Location in Keil

Is it impossible?
 

Re: Function Location in Keil

It is possible,of course. But you do not specify which Keil compiler you have in mind. For example, in CARM compiler for ARM's, it is possible directly using language extensions directives, described in manual or web side. But most elegant method, and with sense for any compiler system, is using the separate name space in the code space and prepare proper linker maping definition directives. First, at compile time, the required code is placed in the separate segment, after that, at link phase, the linker place this part of code inside required absolute addresses inside the output. For every kind of the Keil compiler you can find proper commands and directives in the compilers and/or linker manuals.
bis
 

Re: Function Location in Keil

Hi,
I am using Keil 8051 Compiler. I searched the manual for this but couldn't find anything about it!! :cry:
 

Re: Function Location in Keil 8051

hai
you can use assembly commands in keil
as it will support both assembly and c in the same program
but you must assure that this location willnot get mixupwith the
rest of the program

regards

sun
 

Re: Function Location in Keil 8051

bis_ said:
start from this page, and read links carefully.
https://www.keil.com/support/docs/3006.htm
bis
No that doesn't solve my problen. I want to write personal bootloader for 89C61X2 within my main application such that application resides in the beginning of program memory (startig from 0x0000) and bootloader resides in the last block of program memory.
 
Last edited by a moderator:

Function Location in Keil 8051

hi CMOS
plz
for what kind of problme you have to use fixed Add ?
there is no limitation for function location code,except for Interrupt functions.
it is possible to save the ADD of a function in a pointer .
 

Re: Function Location in Keil 8051

Hi, I need to put the boot loader at the end of the program memory so that I can upgrade my application firmware using it whenever required. If both bootloader and application resides in same memory, it won't be possible to just erase the application area using bootloader, it will erase itself also. I hope you understand what I am trying to do.
 

Re: Function Location in Keil 8051

Can you make 2 programs?

1 for the main loop;
and other for the BOOT loader.

then load into the uC the 2 programs, in 2 times.


regards.
 

Re: Function Location in Keil 8051

sat22 said:
Can you make 2 programs?

1 for the main loop;
and other for the BOOT loader.

then load into the uC the 2 programs, in 2 times.
Well I too was thinking of doing the same. But if its possible in Keil to locate a function, it would be easier to maintain the program!
 

Re: Function Location in Keil 8051

you can configure the linker to put the code in a specific part of a memory.

see that image. what i did was say to the linker to put de program beyond the address 0x3000. in the memory map in the back you can see that is true, the code begins in the position 0x3000.


regards.
 

Re: Function Location in Keil 8051

sat22 said:
you can configure the linker to put the code in a specific part of a memory.

see that image. what i did was say to the linker to put de program beyond the address 0x3000. in the memory map in the back you can see that is true, the code begins in the position 0x3000.
regards.

NO that will put my entire application at memory address 0x3000!!!

I just want one function to be loacated at say 0xFA00 and rest entire application from addres 0x0000!
 

Re: Function Location in Keil 8051

My idea was to do that only for the boot program.
The rest of the program will be linked normaly.

And the address 0x3000 was only an example!


regards.
 

Re: Function Location in Keil 8051

sat22 said:
My idea was to do that only for the boot program.
The rest of the program will be liked normaly.

And the address 0x3000 was only an example!


regards.
That means I have to make 2 separate projects :(
 

Re: Function Location in Keil 8051

CMOS said:
sat22 said:
Can you make 2 programs?

1 for the main loop;
and other for the BOOT loader.

then load into the uC the 2 programs, in 2 times.
Well I too was thinking of doing the same. But if its possible in Keil to locate a function, it would be easier to maintain the program!

I thought that the idea was that!

regards.
 

Re: Function Location in Keil 8051

Ok solved this one too!! :D

You just have to go to Project-> Options For Target -> BL51 Locate and enter the following line in "code" text box.

Format is ?pr?function_name?file_name(address)"

Example: ?pr?start_bootloader?bootloader(FA00h)

Thanks all for helping.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top