Yet another bootloader question

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

Hi!

I am freaking out here. I want to write a bootloader and have already read dozens (if not hundreds) of pages. Its just not working, all the examples and tutorials dont give me the info I need to get it to work. 

 

angry

 

I have a mega162 with 0x1C00 bootstart set in the fuses. So in my application I do an asm volatile ("jmp 0x1C00") to get in the bottloader. But I cant get the bootloader to flash to 0x1C00. I have tryed all the things with .text=0x1C00 and --section-start (or similar in the linker part) and the __section__ stuff. But it either does absolutely nothing and just flashes to 0x0000 or gives me error messages. 

So the simple question is: how can I flash the bootloader to the bootsection using AVR Studio 7 and C++??? Nothing I have found worked.

I dont need interrupts, just the uart, so the IVSEL doesnt need to be set. The programming stuff itself is not an issue (yet). Just flashing the damn thing where its supposed to be.  cryingcryingcrying

 

Thanks a lot!

 

Regards

 

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

Atmel addresses for flash are word addresses!  GCC though treats it as byte addresses, so double your address and see what happens, i.e. 0x1C00 => 0x3800

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Ok, thanks a lot! I thought the 0x1C00 already was the double and 0xE00 was the internal yes 

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

Nickelgrass wrote:
Ok, thanks a lot! I thought the 0x1C00 already was the double and 0xE00 was the internal

If you cannot envision hex in the real world then convert it to decimal. 0x1C00 is 7,168 (and 0xE00 is 3,584). Given that the meag162 is a 16K chip and bootloaders are generally somewhere between 0.5K and 2K in size then you are looking for an entry/boundary address around the 14,000..15,000 mark. So clearly 7,168 (and definitely 3,584) are not in the right ball park. You can therefore assume it must be referring to 16bit addressing and needs to be doubled to get a byte address.

 

Another way to look at it is that the top address in a 16K chip is 0x3FFF and 0x3000 is 12K. So it's got to be somewhere between 0x3000 and 0x3FFF. Again 0x1C00 isn't - so it must be a 16 bit address.

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

Yes it was quite obvious, thanks for the reply. I just somehow didnt get it. blush