I have a customer who will be using Hitech C on a project, and I will be writing a bootloader so they can load the compiled .hex files into the product in production. I don't have the time to get into learning the innards of the C system at the moment, and my customer is new to C and PICs, so I was wondering if any Hitech C users had a quick answer to the following :=20 My bootloader (to be adapted from a previous product) uses the first 4 and last 256 program words - it is jumped to on reset, determines whether or not someone is trying to send it some code up the serial port, and if not, jumps into the main application code.=20 The main issue is that the Hitech compiler will put its own code at locations 0 to 3, presumably just setting the page preselect bits and jumping to its start entry point.=20 With the bootloader present, the code in these locations needs to jump into the bootloader, and the bootloader then needs to know where in memory the C code entry point is. =20 I see 2 solutions :=20 1) Can Hitech C (presumably the library or link configuration) be _easily_ tweaked to tell it to put the entry to it's startup code at a specific FIXED address (e.g. just before the bootloader), so the bootloader knows that by jumping to this address it will start the C application. Any pointers on how to go about doing this (if possible) would be appreciated - I know from experience with another (non-PIC) C system that it can take ages to track down how and where to do subtle tweaks like this in the mass of make, config and header files that comprise the avarage C project! 2) My PC software that talks to the bootloader can look at the first 4 words of the .hex object code it's being asked to download, and relocate it to a fixed address known by the bootloader. This assumes that C will generate a reasonably constant set of instructions for these 4 locations, although the jump target address may be different. This is not a problem, although it gets more messy if this target address may be on a different page, or the optimiser is trying to be clever by squeezing the odd instruction into any spare locations within the first 4 words. .=20 Does Hitech C always generate a fixed set of instructions at the reset vector like this?(or can it be forced/tricked into doing so?) Also, how do you tell Hitech C not to use the last 256 (or whatever) words of program memory? Obviously by C, I mean the whole compile-link process.=20 =20 Thanks in advance for any hints.=20 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's