Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

atmega328pb bootloader

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
marcomilazzo

Bascom Member



Joined: 12 Oct 2005
Posts: 15

blank.gif
PostPosted: Mon Nov 25, 2019 8:00 pm    Post subject: atmega328pb bootloader Reply with quote

Hi
i an using the bootloader Bootloader.bas with atmega328pb
the bootloader is about 32K bin and my program about the same !
how is this possible?
there is a bug if i do not use the baudrate for all

How big is the bootloder ?
what are the correct setting for atmega328pb?

thank's marco




(BASCOM-AVR version : 2.0.8.2 )
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1532
Location: Basel, Switzerland

switzerland.gif
PostPosted: Mon Nov 25, 2019 9:55 pm    Post subject: Reply with quote

Hi,

Read the data sheet. The bootloader "sits" at the top end of the Flash Memory (in last few KB).

You download the bootloader code to the AVR, the first 30Kb or so are empty, with the bootloader at the end. When you load you program with the bootloader, the bootloader starts at the lowest Flash address.

So, for example if you AVR has 32Kb Flash and the bootloader is 2Kb in size, the main application can only be Maximum 30Kb in size.

The starting address for the bootloader can usually be defined using the "fuse bits". Read the data sheet for the CPU to see what Options are available.

Regards
Ian Dobson

_________________
Home of AVRTimer, the Bascom timer value calculator.
http://www.planet-ian.com

Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile Visit poster's website
marcomilazzo

Bascom Member



Joined: 12 Oct 2005
Posts: 15

blank.gif
PostPosted: Tue Nov 26, 2019 12:18 pm    Post subject: Reply with quote

Hi Ian
Thank's for the answer

Still ,how big is the boot loader? i'm courious
after compilation it's about 30KB
i tryied
$boot = $3c00
$inc Bootloader , Nosize , "BootLoader.bin"
this way i can program all togheter

and it's too big

if i program the bootloader and then i pass my code all works fine
i like to understand

marco
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1532
Location: Basel, Switzerland

switzerland.gif
PostPosted: Tue Nov 26, 2019 12:37 pm    Post subject: Reply with quote

Hello,

have a look at the data sheet for you CPU. Most AVR's have fuse bits that define the maximum size of the bootloader/the start address for the bootloader.

Your main application cannot be so large that it overwrites part of the bootloader.

Regards
Ian Dobson

_________________
Home of AVRTimer, the Bascom timer value calculator.
http://www.planet-ian.com

Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile Visit poster's website
marcomilazzo

Bascom Member



Joined: 12 Oct 2005
Posts: 15

blank.gif
PostPosted: Tue Nov 26, 2019 12:58 pm    Post subject: Reply with quote

Hi Ian
i think i got it

compiling the bootloader it gives a file large to fit all the memory
while the code is at the end .eliminating the usless FF i get less then 2K(the true bootloader)

is there a way to add the bootloader code to my code and tell it to go in the desired position ?

marco
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum