Searching \ for '[PIC]: Hi-Tech C code location at high address?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=c
Search entire site for: 'Hi-Tech C code location at high address?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Hi-Tech C code location at high address?'
2000\11\06@052735 by JP.BROWN

flavicon
face
Hiya All!, do you use Hi-Tech C?, have you noticed that the code is put at
the top of program memory by default?. I am trying to find a way to force
it to put the code at low code addresses. A pragma statement (or other
'trick') in the C source code would be preferable to a complex linker
option (so that I can do everything from the IDE).
I have looked at the manual but I can't figure out how to do it
any help would be appreciated :-)   ----John

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use spam_OUTlistservTakeThisOuTspammitvma.mit.edu?body=SET%20PICList%20DIGEST




2000\11\06@074841 by Andrew Kunz

flavicon
face
John,

You need to use the linker to do this.  It isn't hard.

You can force any chunk of code anywhere into memory provided you compile each
module separately.

You need to change the PSECT for each module that you want loaded differently,
then you tell the linker where it is permissible to load that module.

It isn't hard, I've done it a number of times myself.  I, too, wish it were
easier, though!

Andy









"JP.BROWN" <.....J.P.BrownKILLspamspam@spam@BRADFORD.AC.UK> on 11/06/2000 05:34:51 AM

Please respond to pic microcontroller discussion list <PICLISTspamKILLspamMITVMA.MIT.EDU>








To:      .....PICLISTKILLspamspam.....MITVMA.MIT.EDU

cc:      (bcc: Andrew Kunz/TDI_NOTES)



Subject: [PIC]: Hi-Tech C code location at high address?








Hiya All!, do you use Hi-Tech C?, have you noticed that the code is put at
the top of program memory by default?. I am trying to find a way to force
it to put the code at low code addresses. A pragma statement (or other
'trick') in the C source code would be preferable to a complex linker
option (so that I can do everything from the IDE).
I have looked at the manual but I can't figure out how to do it
any help would be appreciated :-)   ----John

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu?body=SET%20PICList%20DIGEST

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
use listservspamspam_OUTmitvma.mit.edu?body=SET%20PICList%20DIGEST




2000\11\07@054058 by JP.BROWN

flavicon
face
Hi Andrew, thank's for the feedback, I wonder if you could give me any
example command lines or other tips on how to make the code link to a
given address?.

I have studied the manual and tried various things with out success.
I have also studied the .map file and the default linker options to try
and figure out how the code is pushed to the top of the map.
(I think  -pfloat_text0=CODE,......   has something to do with it?)
I have tried linking manually using the command line:

picl -Pcode=06,text0,text1,text2,text3,text4 -16f84 filename.obj

the linker accepted this but still put the program code at the end of code
memory. I have also tried tweeking the linker settings from the make menu
but all to no avail.

-------John

On Mon, 6 Nov 2000, Andrew Kunz wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu




2000\11\07@213737 by Clyde Stubbs

flavicon
face
On Mon, Nov 06, 2000 at 10:34:51AM +0000, JP.BROWN wrote:
> Hiya All!, do you use Hi-Tech C?, have you noticed that the code is put at
> the top of program memory by default?. I am trying to find a way to force
> it to put the code at low code addresses. A pragma statement (or other

Any particular reason why you care where in the ROM the code goes?


--
Clyde Stubbs                     |            HI-TECH Software
Email: KILLspamclydeKILLspamspamhtsoft.com          |          Phone            Fax
WWW:   http://www.htsoft.com/    | USA: (408) 490 2885  (408) 490 2885
PGP:   finger RemoveMEclydeTakeThisOuTspamhtsoft.com   | AUS: +61 7 3355 8333 +61 7 3355 8334
---------------------------------------------------------------------------
HI-TECH C: compiling the real world.

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu




2000\11\08@041428 by JP.BROWN

flavicon
face
Hi Clyde, Yes the reason why I need the code to locate at the bottom of
program memory (rather than the top) is I have a number of simple pic
programmers which I use for teaching, the design of the programmer means
that the program words need to contiguous (or with gaps no greater than
about 50) between program words).
I have looked at the manual and the .map file (and the linker defaults)
and just cannot figure out what causes the program code to float to the
top of the program memory map.

Regards   John

On Wed, 8 Nov 2000, Clyde Stubbs wrote:

{Quote hidden}

         -----  John P. Brown      EraseMEJ.P.Brownspambradford.ac.uk ----
          \            --- Witty remark goes here ---         /
           --------------------------------------------------

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads




2000\11\08@053424 by Bill Westfield

face picon face
   the reason why I need the code to locate at the bottom of program
   memory (rather than the top) is I have a number of simple pic
   programmers which I use for teaching, the design of the programmer
   means that the program words need to contiguous (or with gaps no
   greater than about 50) between program words).

Are you sure?  Perhaps the programmer software can be improved, or has
already been improved.  Are you using one of the common simple PIC
programmers?

For that matter, don't the compilers produce something like intel HEX
format?  I wouldn't think it would take more than a couple hours to
write (and debug) a simple program that would take an arbitraty intel
hex file, sort bytes and fill in any gaps with your choice of fill
value (probably 0xFFFF) to keep your programmer happy.  I can't
comment on how difficult it would be to add a step to a random IDE's
windup, or how much "programming time" this would add to the process.

BillW

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads




2000\11\08@075234 by JP.BROWN

flavicon
face
Hi Bill, thank's for the feedback.
The pic programmers I have for the class have on board firmware for
programming the pic, the design has advantages (platform independent) but
they would not be easy to modify. I have considered writing a program to
fill in the holes in the hex file.

Some kind person has told me how to modify the code and linker options to
make the code run from low rom addresses, I have tried it and it works.
For anyone else wanting to do this create a project (from the MAKE menu)
and add this line to the linker options:

-pmyprog=06

In your C program add this line near the beginning of your program:

#pragma psect text%%u=myprog

The program will need to compiled using 'make' (rather than 'compile'),
you will now see that the program code runs from 06h (this is the lowest
address I can use because the vectors and some other things occupy the
bottom 6 words (000 - 005) (by the way I am using the picclite program)

(a big thank you to Tomasz Sztejka :-)

Regards   John

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads




2000\11\09@175311 by Clyde Stubbs

flavicon
face
John,

> program memory (rather than the top) is I have a number of simple pic
> programmers which I use for teaching, the design of the programmer means

Without wanting to be seen to be finger pointing, aren't you trying
to fix the wrong problem? It seems to me that it's the programmer that's
broken.

> and just cannot figure out what causes the program code to float to the
> top of the program memory map.

It's just a consequence of the way the code allocation is done, there's
no particular reason for doing it that way, but neither is there any (good)
reason not to. The code allocation has to cope with multiple ROM pages,
so it is impossible to ensure that there will never be gaps in the
allocation. Given that, there's little value in trying to ensure that there
are no gaps some of the time.

Regards, Clyde

--
Clyde Stubbs                     |            HI-TECH Software
Email: RemoveMEclydeEraseMEspamEraseMEhtsoft.com          |          Phone            Fax
WWW:   http://www.htsoft.com/    | USA: (408) 490 2885  (408) 490 2885
PGP:   finger RemoveMEclydespam_OUTspamKILLspamhtsoft.com   | AUS: +61 7 3355 8333 +61 7 3355 8334
---------------------------------------------------------------------------
HI-TECH C: compiling the real world.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics




More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...