How to create a bootloader that changes the flash

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

Hello.
I am here with a second question.
I've got some code too, but on a different computer and I can't move it here.

So I am doing an application that will fill the whole Flash.
I read that It needs some sort of bootloader, otherwise there could be complications...
...I will set up the fuses as necessary... And

On the x86 the memory model of the bootloader is:
Bootloader - "0x0000"
Flash (i mean the rest of RAM) - after the bootloader

The ATmega8 is like:
Flash - 0x0000
Bootloader - 0xFF - at the end of flash

So:

.ORG 0x0000
...
...
LDI     ZL, LOW(FLASH)
LDI     ZH, HIGH(FLASH)
SPM; store program memory to the label FLASH

FLASH:; a regular label at the end of bootloader

Would this code work as the flash physically doesn't follow the bootloader?

I think it won't.

This topic has a solution.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No the SPM opcode can only operate in the BLS. So code at 0 will not successfully SPM. You need to read the section in the datasheet about bootloaders if you plan to try and do this. It explains all this.

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

clawson wrote:

You need to read the section in the datasheet about bootloaders if you plan to try and do this. It explains all this.


I read it two more times and finally got it and the code is working.
Thanks for not showing me the code. :)

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

Interesting thread title.

 

Quebracho seems to be the hardest wood.