avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: AW: [avr-gcc-list] avr-c++ static constructors in bootloader usage


From: Haase Bjoern (PT-BEU/EMT)
Subject: AW: AW: [avr-gcc-list] avr-c++ static constructors in bootloader usage
Date: Wed, 20 Sep 2006 09:43:10 +0200

So the problem is not linked to static constructors. The problem is rather the 
inherent limitation of avr-gcc to 64k of static data in flash: All of the 
pointers to flash are 16 bits. I.e. it will be necessary to find a way to make 
gcc load the RAMPZ (?) register with a different value for boot loaders. The 
place to fix this is avr-libc and not gcc itself.

As a quick fix, you could probably add an assembler module to your project with 
one single command that is placed in the .init1 section. One single command 
that sets the RAMPZ (?) register to the appropriate value. This command will be 
inserted in front of the ram initializations.

HTH,

Bjoern.


-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von Jörg Diederich
Gesendet: Mittwoch, 20. September 2006 09:39
An: address@hidden
Betreff: Re: AW: [avr-gcc-list] avr-c++ static constructors in bootloader usage

hello,

a setting of the DDR doesn't change the problem. DDRE on at90can128 is at 0 at 
default, which means input. if 
a set of the appropriate PORTE bit occurs, a pull-up resitor is activated (plz 
see manual at page 66 for details, if interested). so my pin is high, this is 
what is is detectable on my board with vcc on a pin.
i tryed setting DDRE anyway. so the pin is an output pin. by writing the 
appropriate PORTE bit, this results in a high level on the pin too (see 
following page in documentation).

you're correct, of course. but it doesn't matter in this case, as (hopefully) 
shown above.
the while-true in constructor was in order to see if the constructor is entered 
or if the mcu does a reset while leaving the constructor.

i followed the asm code with objdump till the table jump. see documentation of 
bug report for a more detailed informations already given by jörg wunsch.

bye Jörg






> ----- Original Message -----
> From: "Haase Bjoern (PT-BEU/EMT)" <address@hidden>
> To: "Jörg Diederich" <address@hidden>, address@hidden
> Subject: AW: [avr-gcc-list] avr-c++ static constructors in bootloader usage
> Date: Wed, 20 Sep 2006 08:53:14 +0200
> 
> 
> Is it possible that you forgot about setting the data direction 
> register properly?
> 
> I'd like to suggest that you have a look at the generated assembly 
> code. E.g. by excecuting
> 
> avr-objdump.exe -d myfile.elf
> 
> The place where the reset vector jumps to will first initialize RAM 
> memory contents and then jump to all of the static constructor 
> functions (there is a table with all of them in memory).
> 
> With a program as short as yours, you should easily be able to 
> follow the code. BTW. Main() probably never should be reached with 
> your small program.
> 
> HTH,
> 
> Bjoern.
> 
> -----Ursprüngliche Nachricht-----
> Von: address@hidden 
> [mailto:address@hidden 
> Im Auftrag von Jörg Diederich
> Gesendet: Dienstag, 19. September 2006 16:09
> An: address@hidden
> Betreff: [avr-gcc-list] avr-c++ static constructors in bootloader usage
> 
> hello,
> 
> so i'm new to this list, a short hello (again) to everyone.
> 
> in using the at90can128, there's a problem with static constructors 
> in bootloaders. the following example does not work as expected.
> 
> #include <avr/io.h>
> /*
>    PORTE rises a pin on my board. used to see what's happening
>   */
> class A {
>   public:
>    A(){
>      PORTE |= (1 << 7);
>      while(1);
>    }
> };
> 
> A a_test ;
> int
> main(int argc, char** args)
> {
>    PORTE |= (1 << 2);
>    while(1);
> 
>    return 0;
> }
> 
> both pins stay low. usart-output didn't work too.
> adress of bootloader/text-section is 0x1E000. another possible 
> start address (0x1F000) doesn't change the problem,
> never tryed last possible address (0x1F800), but i don't expect it 
> to work either.
> 
> trying to switch off most compiler options doesn't result in a change.
> gcc version 4.1.1, avr-libc 1.4.4
> 
> there's a bug-report at 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141 for this.
> 
> bye Jörg
> 
> 
> --
> _______________________________________________
> Get your free email from http://www.graffiti.net
> 
> Powered By Outblaze
> 
> 
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

>


-- 
_______________________________________________
Get your free email from http://www.graffiti.net

Powered By Outblaze


_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




reply via email to

[Prev in Thread] Current Thread [Next in Thread]