write code in Bootloader Section

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear all,

I want to write a code in boot loader section in atmel studio

How we can set staring address of the code in atmel studio?

Is there any thing else to set?

 

This topic has a solution.
Last Edited: Sat. Feb 15, 2020 - 05:58 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you trying to write a bootloader or use part of that space for your application?

What device are you targeting?

Where is the base of your devices bootloader section located?

 

Are you using C or assembly?

If C, are you using:

  • the standard C start files?
  • the standard ISR prolog and epilog?

 

The simple (i.e incomplete and overly simplistic) answer is to set the start address for the linker in

Project Properties / Toolchain / Linker / Miscellaneous as required

(e.g.  "-Wl,--section-start=.text=0x1FC00")

 

More details on what you are trying to achieve will help us help you.

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Thank you frog_jr

what is the other menus?

like memory , Optimization and else?

 

 

Last Edited: Sat. Feb 15, 2020 - 06:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just build it like a "normal" program with that one exception of -Ttext=0xnnnn

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Isn't there a guide or sample code for demoing how to write and build bootloaders in gcc?

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dear  frog_ir

I did it but atmega8 micro will be restart periodic about every 67ms it will be watchdog reset.

why?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You also asked this in another thread, please keep to posting a question only 1 time.....

https://www.avrfreaks.net/forum/...

 

* other tread locked. *

 

 

Last Edited: Wed. Feb 19, 2020 - 07:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hasanzadeh99 wrote:
restart periodic about every 67ms it will be watchdog reset.

why?

Because that is exactly what a watchdog is designed to do!

 

You need to reset the Watchdog within the 67ms to prevent it from timing-out and causing a reset.

 

Time to read-up on the watchdog.

 

http://www.ganssle.com/watchdogs.htm

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No IT is not watchdog!

The program start from beginning of the main ...

and It is not restarting and watch dog is diabled!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In #6, hasanzadeh99 wrote:
it will be watchdog reset.

Then, in #8, hasanzadeh99 wrote:
No IT is not watchdog!

 

OK - so now I'm confused!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see more and found interrupt is the problem

by disable timer interrupt or USART receive interrupt problem will be solved completely

but Why? and How we can solve this issue?

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

For any interrupts that are active, you must provide an interrupt handler (or disable the interrupts).

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

If this is a bootloader how much do you know already about "IVSEL"? if not a lot then I suggest you change that situation.

 

However there is a more fundamental question here - why on earth would you need ANY interrupt in a bootloader? There are at least two fairly strong reasons to not have them:

 

1) if you don't use any interrupts you don't need an IVT and in some micros that can be a considerable saving in the BLS you have available. If the bootloader is smaller because of no vector table then the app section can be bigger.

 

2) when you use a bootloader then everything in the app can be easily replaced - so bugs can be fixed. But the one thing you can't change is the bootloader itself - so it must be exactly right, 100% error free on day one. To achieve that you keep it as small and simple as possible. One way to reduce complexity is to avoid interrupts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thank you claswon

I need to interrupt in the bootloader!

but I suggest your solution is move interrupt vector to start of the boor section am I right?

by IVSEL?

why interrupt in application not will be work?

what is the problem that we have interrupt vectors at the start of the application section?

boot loader lock bits can be usefull? or what is the BLB ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hasanzadeh99 wrote:
I need to interrupt in the bootloader!

Do you? Why?

 

http://www.catb.org/esr/faqs/smart-questions.html#goal

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

because RX serial is receiving data by interrupt , timers and else....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

None of those requires interrupts!

 

EDIT: Or, conversely, all of those can be done without interrupts!

 

http://www.catb.org/esr/faqs/smart-questions.html#goal

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Feb 19, 2020 - 11:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

hasanzadeh99 wrote:
because RX serial is receiving data by interrupt , timers and else....
A bootloader only does one thing - it sits in a loop receiving one SPM packet of data and when it has enough it takes a short time out to program that page of data then does the whole thing all over again until all the pages are programmed. As long as the sender and the receiver agree (by some protocol) to stop sending page data while the last page is being programmed there's no need to interrupts to be involved. So I'd maybe rethink the design of your data transfer protocol if you think it has to be able to operate with continuous data delivery.