The compiler (3.3) seems to put an 'lpm' instruction for the table jump in switch/case. This doesn't work very well in boot code (>64K).
Tell me I'm wrong and just forgot to flip some gcc switches.
Thanks for your attention
Yes, I've done that already and it works fine.
However lengthy if-else-if do look messy compared to switch/cases.
I'll try to dig into the gcc docs for another solution.
BTW: my other posting about PSTR() is also related to this ugly addressing with
I just started using your new 'boot.h', looks fine so far(fingers crossed).
FWIW, the switch/case statement does not work in the IAR compiler either.
Well I guess thats not a trivial problem, as the compiler doesn't have a clue where the code is placed. And the linker/locater doesn't have a clue aboat the actual code.
And still Atmel claims the AVR architecture was designed with C in mind.
What C? Vitamins?
That ugly RAMPZ bit to get the neccessary 17 bit address can't make any compiler writer really happy.
Nevertheless I anyhow still love the chip.
BTW: Is there anybody who knows if icc deals with this issue correctly?
icc has, if I remember correctly, some setup to put code in boot section.
With boot.h it was a childs play.
I had more difficulties fiddling with the ihex file.
I simply cut-and-pasted your example into one function 'flashWritePage(addr, data)' and that was it.
My application is only 25K (so far), so I haven't yet tested >64K.
I run at 16MHz so my max serial speed is 57k6 (well 250k/500K/1M works too, but that's too fast for me) but anyhow the code loads faster than with my USBAVR programmer.
I see only happy faces.
© 2021 Microchip Technology Inc.