David wrote: > I am trying to get a bootloader running with the PIC18LF1320 micro and > find the program is writing over itself. > > The bootloader calculates the memory top and erases from where > bootloader ends and the end of memory. > The problem is that instead of the bootloader being placed in the > bottom 0x300 bytes the compiler is placing most of the code up at > 1B62. This means the bootloader writes over itself when it runs. > > Does anyone know how I can make the Hi-Tech C compiler put the > bootloader code in the block from 0000 to 0300 ? Just for an example that might give you some clues... to get the TinyBootloader to work in a recent PIC project I had to tell the compiler to NOT put application code where the Bootloader resides. In my case I added the following in MPLAB under Project/Build options/Project/PICC Linker - use alternate settings: -RESROM1F9C-1FFF Typically your Bootloader code will be compiled/assebled sepeartely from your application code and should have directives to be located at a specific address. As shown in the example above, your application code might reasonably be expected to reside anywhere else in your chip except where the Bootloader resides. Hope that helps some! -- Brent Brown, Electronic Design Solutions 16 English Street, St Andrews, Hamilton 3200, New Zealand Ph: +64 7 849 0069 Fax: +64 7 849 0071 Cell: 027 433 4069 eMail: brent.brown@clear.net.nz -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist