Diego -- How many bytes is "fuses"? Is it pretty constant? Is "fuses" part of the 32K?
If "fuses" is constant, you could append it binary file before feeding back to 'objcopy' to make the intel hex file. E.g. 'fuses.bin' are the last one byte of your download..... % dd if=file.bin of=t1.bin bs=32767 count=1 conv=sync % cat t1.bin fuses.bin > file_full_range.bin % $ objcopy -I binary -O ihex file_full_range.bin file_ready_for_bootloader.hex "conv=sync" will do the padding. I had to read the manual. :) take care, *brianW On Sun, Jan 29, 2012 at 8:27 AM, Diego Herranz <diegoherr...@diegoherranz.com> wrote: > Thanks a lot for your help > > Finally this is what I did: > > $ objcopy -I ihex -O binary file.hex file.bin > $ dd if=file.bin of=file_full_range.bin count=1 bs=32768 (18f2550 memory > size in bytes) > $ objcopy -I binary -O ihex file_full_range.bin > file_ready_for_bootloader.hex > > Opening the files with a hex editor everything seems to be OK but I haven't > tested it yet. If I do, I'll let you know. > > Several things: > > - I haven't been able to convince objcopy that the output size is 32768 or > whatever, and so, not needing to use dd, do you know how to do it? > - Option bs in dd is: "read and write BYTES bytes at a time". So I needed to > add count=1 to copy just (count times bs) = 1 x 32768 = 32768 bytes > - Doing that, if original hex is smaller than 32768 dd doesn't fill with > zeroes or anything. I needed to include fuses in original file.hex (fuses > are on a very high address location) and so, file.bin is something like > this: > > Program code > Zeroes > Zeroes > Zeroes > Fuses > > After dd, file_full_range.bin is: > > Program code > Zeroes > Zeroes (ending exactly on address 32768-1=32767 and without fuses as > intended) > > Thank you very much > > > > > > On Sat, Jan 28, 2012 at 5:56 PM, Unix Savvy Brian <bw...@value.net> wrote: >> >> Diego -- >> >> Look at 'objcopy', after doing the link. It can translate formats. >> You might be >> able to convince it the output size is 4K ( or some other "round number" ) >> in >> order to fill unused memory. I've used the full-blown GNU version on >> 32-bit >> systems and it is quite flexible. Output format of binary will strip >> COFF headers. >> >> >> If that doesn't do it and you have UNIX tools, after using 'objcopy' >> to strip the >> header, try using 'dd' to get to a specific size.... >> dd if=myprog.bin of=readyfordownload.bin bs=4096 >> >> The 'bs=N' would be the size required by your loader to fill all of >> memory. 'dd' >> will fill the extra bytes with zeros. >> >> >> I'm just a lurker..... >> >> >> HTH, >> *brianW >> >> >> >> >> >> On Sat, Jan 28, 2012 at 4:06 AM, Diego Herranz >> <diegoherr...@diegoherranz.com> wrote: >> > Hi! >> > >> > I want to use a bootloader (Scene Double bootloader) for PIC16 and it >> > requires to export the full program memory range of your application >> > (even >> > unused range), with no eeprom nor fuses. >> > >> > This is the exact text present in the bootloader manual: >> > >> >> >> >> Exporting a HEX File from MPLAB >> >> >> >> >> >> >> >> Once you have written some firmware (using Sample Application as a >> >> guide) >> >> you will need to provide a hex file to format for >> >> use with the Bootloader. >> >> DO NOT use the hex file generated directly by MPLAB when you compile >> >> the >> >> application, as this may not include the full >> >> memory range (we need a file of a known size), and also contains >> >> configuration bits which we do not want. >> >> Instead, compile and the choose File->Export. Set it to only output >> >> Program Memory (no EEPROM or configuration bits). The >> >> memory range should be the whole range of the device (or, choose the >> >> start >> >> to be the starting address of your user >> >> application space, which is 0x2400 in the Sample Application example, >> >> and >> >> then end to be the top program memory >> >> address in the device). >> > >> > >> > Does anybody know how to do this with SDCC? >> > Is it related to linker as gplink is generating the COFF file from which >> > the >> > hex file is finally created? >> > >> > Thanks a lot. >> > >> > >> > ------------------------------------------------------------------------------ >> > Try before you buy = See our experts in action! >> > The most comprehensive online learning library for Microsoft developers >> > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> > Metro Style Apps, more. Free future releases when you subscribe now! >> > http://p.sf.net/sfu/learndevnow-dev2 >> > _______________________________________________ >> > Sdcc-user mailing list >> > Sdcc-user@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/sdcc-user >> > > > > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user > ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user