How shift the Code Generated by MikroC to some other locatio

General discussion on mikroC.
Post Reply
Author
Message
07arunsharma
Posts: 46
Joined: 16 Apr 2011 14:37

How shift the Code Generated by MikroC to some other locatio

#1 Post by 07arunsharma » 25 Feb 2012 22:44

Hello!! everyone i had purchased a PIC18F4550 development board from a company in India.

That board is having a inbuilt Bootloader and the problem is that i can't use mikroc for this purpose..

because the code generated by mikroc is overwriting the bootloader thats why program is not transferred in that.
i want to shift the code little bit in mikroc

like in hitech c it is as follow
void main () @ 0x0000A0

okay
what it will be in MikroC
I love mikroc thats why i want to use it...

I have tried this one
but it didn't work

void main() org 0x0000A0

Some one pls help me..
Thanks in Advance

p.erasmus
Posts: 3391
Joined: 05 Mar 2009 10:28

Re: How shift the Code Generated by MikroC to some other loc

#2 Post by p.erasmus » 25 Feb 2012 22:49

You do it exactly as you showed in your post by hitech compiler,
look in the mikroC help File for orgall and absolute directives
example
void main () orgall 0x0000A0
P.Erasmus
Saratov,Russia
--------------------------------------------------------------

07arunsharma
Posts: 46
Joined: 16 Apr 2011 14:37

Re: How shift the Code Generated by MikroC to some other loc

#3 Post by 07arunsharma » 26 Feb 2012 06:16

Thanks for your reply..

I had read the documentation and found that

Code: Select all

#pragma orgall 0x0000A0
and it works it shift my code to 0x0000A0 location
Capture.PNG
Capture.PNG (61.32 KiB) Viewed 1734 times
Here is the shift in my code..
But still above two lines contains some data what is this..
and how to shift that

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: How shift the Code Generated by MikroC to some other loc

#4 Post by janko.kaljevic » 27 Feb 2012 16:59

Hello,

After you do

Code: Select all

#pragma orgall 0x0000A0
all functions will be on addresses higher than specified.

But there will be stored stored addresses for GOTO labels on addresses 0x0000, 0x0008 and 0x0018, which is exactly shown on your picture.

I believe that Microchip bootloader should be aware of this, and it should take care for those instructions.

Best regards.

Post Reply

Return to “mikroC General”