|
|
View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
How to combine two hex? [Solved] |
Posted: Mon Sep 12, 2022 8:19 pm |
|
|
I think I asked this before but can't find the thread.
I have an USB bootloader and want to combine it with an already generated HEX.
The bootloader start at 0x0000 and the main program at 0x3000.
The device is a PIC16F87J50.
I have this as the bootloader code
Code: |
#include <18F67J50.h>
#fuses INTRC_PLL,PLL2,NOCPUDIV,NOIESO,NOFCMEN,STVREN,CCP2E7,NOWDT,WDT2048,PROTECT //WDT8Seg.
#use delay(clock=48M)
#use rs232(UART1,stream=GSM,NOINIT)
#use fast_io(ALL)
#define _BOOTLOADER
#define LOADER_END 0x2FFF
#include <bootloader.h>
|
And at the main program
Code: | #use delay(clock=48M)
#define BOOTLOADER_AT_START 0x3000
#define LOADER_END 0x2FFF
#include <bootloader.h> |
Now I want to compile the bootloader and add the HEX generated by the main program to the final HEX. _________________ Electric Blue |
|
|
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
|
Posted: Mon Sep 12, 2022 9:45 pm |
|
|
I just solved!
If somebody needs to do the same can use this code line as example.
Code: | #import (FILE=D:\Projects\BootHex\GPS_100_V19-1-1\Standard\GPS_100_V19D.hex,HEX,RANGE=0x3000:0x1FFFB) |
Is pretty simple, the main code to import starts at 0x3000, so everything before that address is ignored and the compiler doesn't complain about the 0x0000 to 0x2FFF being used even when the HEX only has NOPs. _________________ Electric Blue |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Tue Sep 13, 2022 3:28 am |
|
|
A quick search on the forum would have found solutions to this.
A few decades ago, the easiest way was to import the bootloader, then the
main program with MPLAB, and export the final file.
Then the #import route became available.
With this is is best to have #FUSES NONE in the main code. Otherwise
you may get a warning because these are present in both files.
Also remember that each program has to do #PIN SELECT setups if
you are using a chip with PPS, so NOPPS1WAY becomes essential.
[url]
http://www.ccsinfo.com/forum/viewtopic.php?t=55747&highlight=combine%2A+files+bootloader
[/url] |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|