THANKS! Many years ago, in a thread I started at http://www.microchip.com/forums/m610634.aspx#610684 , JasonK at Microchip wrote "Unfortunately, the address attribute will work only in program flash or data memory but not boot flash. You will need to modify the linker script to get functions at a specific address in boot flash. We may update the address attribute to work in boot memory in a future release." I will keep messing with this. THANKS for all your time! Harold > Harold, > > Microchip has some sample boot-loaders that you can use as a template, > including linker-scripts. > > To avoid the problem you are facing, the correct solution would be to > create a custom linker-script that maps all the executable code sections > to the boot area (0x9fc0xxxx and 0xbfc0xxxx addresses). > > If you do that, then perhaps the address attribute works, because *there > is* an executable section mapped into the area that your address points > to. > > But you could also create a specific section for you function. > > Cheers, > > Isaac > > > > > Em 09/01/2018 17:15, Harold Hallikainen escreveu: >> THANKS! As I mentioned before, I find linker scripts pretty cryptic. >> I'll >> see if I can figure out what you're suggesting. >> >> Yes, this is for a bootloader. What I need is to ensure that my function >> that copies firmware from external flash to internal flash is always at >> the same address in the boot section. I originally put a jump table in, >> but it ended up in the application area instead of the boot area, so I >> cannot rely on it. I need to ensure my function stays at the correct >> address. So far, I've done this by having the application send an error >> message to the UART I'm watching during debug if the function is not at >> the right address. I then add or subtract nops to fix it (ideally it >> would >> not move anyway, but sometimes things change). >> >> I adapted the default linker script back in 2010 for this. It does not >> have a MEMORY section, but, instead, includes ProcDefs.ld, which I >> modified and renamed, and which DOES have a MEMORY section. >> >> I have: >> >> kseg0_boot_mem : ORIGIN =3D 0x9FC00490, LENGTH =3D 0x970 >> BootJumpTable_mem : ORIGIN =3D 0x9FC01000, LENGTH =3D 0x1000 >> >> However, it looks like I never made a section that used >> BootJumpTable_mem, >> so that's probably why the jump table ended up in the application flash. >> >> My current thinking is that I need to create a small MEMORY section at >> the >> address I want my function to end up at, then create a SECTIONS with an >> ORIGIN with the MEMORY section name. Does that sound about right? >> >> It would sure be easier if the address attribute worked! >> >> THANKS! >> >> Harold >> >> >> >> >>> Harold, >>> >>> I used assembly just because I wanted to ensure that the entry-point >>> had >>> a fixed length. I have an array of them. >>> >>> You can use "__attribute__((section(...),keep))" in a C function. >>> >>> Cheers, >>> >>> Isaac >>> >>> >>> >>> Em 09/01/2018 15:38, Isaac M. Bavaresco escreveu: >>>> Oops! Forgot some pieces... And used a wrong address... >>>> >>>> >>>> In the linker-script: >>>> >>>> _SECONDARY_ENTRY_PT =3D 0xBFC02F00; >>>> MEMORY >>>> { >>>> ... >>>> /* Do not forget to reduce kseg0_program_mem to exclude the bytes o= f >>>> the section below */ >>>> secondary_entry_pt : ORIGIN =3D 0xBFC02F00, LENGTH =3D=C3=82=C2 =C3= =82=C2 =C3=82=C2 =C3=82=C2 >>>> 0x10 >>>> ... >>>> } >>>> SECTIONS >>>> { >>>> ... >>>> .secondary_entry_pt _SECONDARY_ENTRY_PT : >>>> { >>>> KEEP(*(.secondary_entry_pt.*)) >>>> KEEP(*(.secondary_entry_pt)) >>>> } > secondary_entry_pt >>>> ... >>>> } >>>> >>>> >>>> EntryPoint.S: >>>> >>>> /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D*/ >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .set=C3= =82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 nomips16 >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .set=C3= =82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 noreorder >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .set =C3= =82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 noat >>>> /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D*/ >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .extern= =C3=82=C2 =C3=82=C2 =C3=82=C2 EntryPoint >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .global= =C3=82=C2 =C3=82=C2 =C3=82=C2 SecondaryEntryPoint >>>> >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .section= .secondary_entry_pt,code,keep >>>> >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .ent=C3= =82=C2 =C3=82=C2 =C3=82=C2 SecondaryEntryPoint >>>> >>>> SecondaryEntryPoint: >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 la=C3=82= =C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 $k0,EntryPoint >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 jr=C3=82= =C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 $k0 >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 nop >>>> >>>> =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 =C3=82=C2 .end=C3= =82=C2 =C3=82=C2 =C3=82=C2 SecondaryEntryPoint >>>> /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D*/ >>>> >>>> Somewhere.c: >>>> >>>> void EntryPoint( void ) >>>> { >>>> ... >>>> } >>>> >>>> >>>> >>>> Em 09/01/2018 12:31, Harold Hallikainen escreveu: >>>>> Thanks! Apparently that does now work in the boot section of flash. I >>>>> saw >>>>> that written somewhere online yesterday. I tried it anyway and got >>>>> "address attribute ignored." >>>>> >>>>> Thanks! More ideas? >>>>> >>>>> Harold >>>>> >>>>>> You can do it without changing the linker script: >>>>>> >>>>>> __attribute__((address())) >>>>>> ( ){... >>>>>> >>>>>> Cheers, >>>>>> >>>>>> Isaac >>>>>> >>>>>> >>>>>> >>>>>> Em 09/01/2018 03:21, Harold Hallikainen escreveu: >>>>>>> I'm finding linker scripts to be pretty cryptic, and the >>>>>>> documentation >>>>>>> from Microchip only slightly less so. >>>>>>> >>>>>>> I have a couple functions that I've managed to get into boot flash, >>>>>>> but >>>>>>> I'd like to set the addresses of these functions. How do I do that? >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Harold >>>>>>> >>>>>>> >>>>>>> >>>>>> --- >>>>>> Este email foi escaneado pelo Avast antiv=C3=83=C6=92=C3=82=C2=ADrus= .. >>>>>> https://www.avast.com/antivirus >>>>>> >>>>>> >>>>>> -- >>>>>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >>>>>> View/change your membership options at >>>>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>>>> >>> >>> --- >>> Este email foi escaneado pelo Avast antiv=C3=83=C2=ADrus. >>> https://www.avast.com/antivirus >>> >>> -- >>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist >>> >> > > > --- > Este email foi escaneado pelo Avast antiv=C3=ADrus. > https://www.avast.com/antivirus > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- FCC Rules Updated Daily at http://www.hallikainen.com Not sent from an iPhone. -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .