From: lottaviano Date: Thu, 13 Oct 2011 16:43:13 +0000 (+0000) Subject: Fix xmega initialization procedure. X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=350223735c1c49b541d69f283fb71782ce374eea;hp=350223735c1c49b541d69f283fb71782ce374eea;p=bertos.git Fix xmega initialization procedure. When compiled and linked the method __init() in the init_xmega.c file is generated as the code for the reset vector (vector 0). As there is also a return instruction generated, it will return from vector 0 and then execute vector 1, which is not implemented, so the reset vector is called..... So the other code does not get executed at all. Assigning the __init() method to other sections does not work either. The same problem persists. I implemented a solution which is two-fold: 1) I use the attribute "constructor" as according to the gcc domumentation (http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html) it should do exactly what we want: "The constructor attribute causes the function to be called automatically before execution enters main ()" 2) This alone did not solve the issue. I had to rename the methode to make it not get called by the reset vector so I renamed the methode to init_xmega. Signed-off-by: Onno git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5161 38d2e660-2303-0410-9eaa-f027e97ec537 ---