Jump to content
Sign in to follow this  
gbgb

Protecting The Boot/interrupt Entry Points

Recommended Posts

If this can already be done, I did not find any reference to it in the manual.

 

1. When you build a program that does not use any interrupts, and do not use the "-rb" flag to relocate it, the resulting code starts immediately after the reset entry point, and uses th area that is otherwise reserved for interrupts. Even if using #pragma sentences that try to force data into this area is disregarded.

Suggestion - add a flag to tell the linker to start code after the reserved memory space

 

2. When using the "-rb address" flag the reset/interrupt vector area is left blank. One has to manually place the correct data (using "#pargama DATA" or other method) so that the code is invoked correctly on reset/interrupt.

Suggestion - add a sub-flag to the -rb flag that will tell it to automatically add the correct "goto" commands.

e.g (for 18F family) - if using -rb 0x300" than the reset entry point of the program is at 0x300, interrupt entry is at 0x308 and low priority interrup entry is at 0x318. Have the linker add a "goto 0x300" at location 0x0000, "goto 0x308" at location 0c0008 and "goto 0x318" at location 0x0018.

Share this post


Link to post
Share on other sites
If this can already be done, I did not find any reference to it in the manual.

 

1. When you build a program that does not use any interrupts, and do not use the "-rb" flag to relocate it, the resulting code starts immediately after the reset entry point, and uses th area that is otherwise reserved for interrupts. Even if using #pragma sentences that try to force data into this area is disregarded.

Suggestion - add a flag to tell the linker to start code after the reserved memory space

 

2. When using the "-rb address" flag the reset/interrupt vector area is left blank. One has to manually place the correct data (using "#pargama DATA" or other method) so that the code is invoked correctly on reset/interrupt.

Suggestion - add a sub-flag to the -rb flag that will tell it to automatically add the correct "goto" commands.

e.g (for 18F family) - if using -rb 0x300" than the reset entry point of the program is at 0x300, interrupt entry is at 0x308 and low priority interrup entry is at 0x318. Have the linker add a "goto 0x300" at location 0x0000, "goto 0x308" at location 0c0008 and "goto 0x318" at location 0x0018.

 

I'm not sure why you'd do (1) - if you're not using interrupts, why worry? As it happens I always use a dummy interrupt() routine in code (even if I'm not using interrupts) to force BoostC not to put actual code in the interrupt location and put a goto at 0x0000. This allows for easy bootloading.

 

I don't have a problem with (2) - but I would prefer to be able to ORG each individual subroutine - that way a single ORG at the beginning would have the effect of pushing everything up if you wanted to, but you could "place" particular routines at different places in memory. Same result but less confusing. Making your own gotos is indeed a pain - but mostly because the BoostC compiler doesn't support using ASM goto 0x0000 address - you can only goto to labels for some reason. Means you have to end up hand assembling things into ASM DATA statements (not fun).

 

For more bootloading magic, see embeddedadventures.blogspot.com

 

regards

Ian.

Share this post


Link to post
Share on other sites

1 - workarounds are always possible (and I use them). I just thought a "built in" linker mecahnism would make life simpler.

2 - I agree that your idea is more flexible than what I suggested, yet again this is meant for somebody who simply wants to use the -rb flag, but still have the program work without manual intervention (e.g - when developping/debugging a program that will later be loaded by a bootloader that resides in low memory)

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×