Jump to content

Recommended Posts

Hi,

I have some basic questions about bootloader,

 

1. I have seen the example bootloader code on the sourcboost site. I noticed only global variables were used, function never take any parameters. Any reason for that?

2. If boot loader uses some ram memory, will the application program overwrite some or all of that ram memory or is the Ram memory unique to bootloader and application program?.

3. If I did not specify -rb command, by default at what location will my code reside?

4. Also I need a common memory space (prefer RAM) which can be accessed by both application and bootloader program. How can I do that. I need this so bootloader can read the application firmware version , vice versa.

 

Thank you

 

John

Share this post


Link to post
Share on other sites

John S,

1. I have seen the example bootloader code on the sourcboost site. I noticed only global variables were used, function never take any parameters. Any reason for that?

Not that I can think of.

 

2. If boot loader uses some ram memory, will the application program overwrite some or all of that ram memory or is the Ram memory unique to bootloader and application program?.

The bootloader and the application don't run concurrently so both can use all available RAM.

 

3. If I did not specify -rb command, by default at what location will my code reside?

The code starts at the end of the interrupt and reset code locations.

 

4. Also I need a common memory space (prefer RAM) which can be accessed by both application and bootloader program. How can I do that. I need this so bootloader can read the application firmware version , vice versa.

Use RAM at fixed addresses (define variables like this int x@0x100 ) and have then defined in a header file that both the application and the bootloader include.

 

I hope that helps.

Regards

Dave

Share this post


Link to post
Share on other sites

Hi

 

This topic put me thinking and one of Dave's comment raised a question.

If I use the "-rb" switch to push my code upwards in flash how does the compiler handle the "interrupt" and "interrupt_low" functions if they exist in the program?

 

 

 

Best regards

Jorge

Share this post


Link to post
Share on other sites

JorgeF,

This topic put me thinking and one of Dave's comment raised a question.

If I use the "-rb" switch to push my code upwards in flash how does the compiler handle the "interrupt" and "interrupt_low" functions if they exist in the program?

The vectoring code that normally jumps to these routines is offset by the address specified. So for example the reset vectoring code normally resides at address 0, if -rb 0x100 linker command line option is used this vectoring code now appears at address 0x100, and so on.

 

Regards

Dave

Share this post


Link to post
Share on other sites

@Dave

 

John S,

3. If I did not specify -rb command, by default at what location will my code reside?

The code starts at the end of the interrupt and reset code locations.

 

I hope that helps.

Regards

Dave

 

 

But if I do not specify the -rb command the RESET VECTOR at 0x0000 points to different location for each of my project.

example in each program it differes.

0x0000 GOTO 0xF0

0x0000 GOTO 0x272

or 0x000 GOTO 0x272

 

So now I dont know where to jump from my boot loader to run main application.

 

If i specify -rb command then it is easy. The reset vector always points to the location I specified on -rb command. So from bootloader I can jump to that location to run my main application.

 

I wish not to specify the -rb command on my main application.

 

Thanks

John

Share this post


Link to post
Share on other sites

John S,

...

I wish not to specify the -rb command on my main application.

So why is that?

 

Regards

Dave

Share this post


Link to post
Share on other sites

Dave,

 

John S,

...

I wish not to specify the -rb command on my main application.

So why is that?

 

Regards

Dave

 

Because anyone who like to use this bootloader will then have to use -rb option in their application.

 

Thanks

John

Share this post


Link to post
Share on other sites

Hi

 

But that is the nature of it.

Any system that has a bootloader, some kind of BIOS or even an OS, imposes a few rules on application development.

In the embeded world the hipotetic problem is less than in other platforms because embeded developers are used to deal with all kind of constraints either from hardware specifics or from a bootloader.

 

OTOH, a bootloader can reside at the top of memory, so leaving the default vectors, RESET and INTERRUPT free.

That would really make life easier to users of the system as the only constraint will be some care on program size. But to stay on the safe side they should use the "-rt" switch when building their projects.

 

To be totaly free on using the PIC resources on a project, the only way is not to have a bootloader or any other kind of resident firmware.

 

 

Just my 2 cents.....

 

Best regards

Jorge

Edited by JorgeF

Share this post


Link to post
Share on other sites

Thank you all for your answer.

Another question.

Is it possible to make a hex file that contains both bootloader and main application.

This will make it easier when I hand over the job to production and they only have to burn one hex file (using dataman, not pickit).

 

Thank you

John

Share this post


Link to post
Share on other sites

Hi

 

There are a few tools laying around the internet that can join HEX files.

I think that even Microchip has one, I recall reading about it in the MCHP foruns.

Its called "hexmate" and in my PC I found 2 copies of it, one in the "bin" folder of "XC8" install and another at a "bin" folder under "MPLAB X" installation.

 

 

Best regards

Jorge

Share this post


Link to post
Share on other sites

Hi

 

I would suggest, if possible, that you use the "hexmate" from Microchip.

It is part of the MCHP toolchains so I expect it to be fine tunned to the PIC devices.

 

 

Best regards

Jorge

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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...

×
×
  • Create New...