[En-Nut-Discussion] devnut_m3n branch

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed Apr 27 20:54:25 CEST 2011


>>>>> "uprinz" == uprinz  <uprinz2 at netscape.net> writes:

    uprinz> Hi Uwe,


    uprinz> Uwe Bonnes wrote:
    >>  I am getting lost...
    >> 
    >> What I did:
    >> 
    >> Compile various gcc for arm-eabi, e.g. from crosstool-NG.  Link
    >> ~/bin/arm-gcc tp the resulting gcc-xxx-eabi-yyy binary
    >> nut/tools/nutconf/nutconfigure -bcomstick \
    >> -cnut/conf/stm32-comStick.conf  -lcomstick -marm-gcc
                                                    ^^^^^^^
    uprinz> First: Looks like linux is pulling other makefiles than I
    uprinz> modified. With my ones the compiler uses -mthumb.  You should
    uprinz> use the cm3-gcc line of make* as the arm-gcc line has definitely
    uprinz> the wrong settings.

Yes, I need to use -mcm3-gcc in nutconf

...
    uprinz> Third: I 99% of my time developed on STM3210E-EVAL and
    uprinz> STM3210C-EVAL kits. I used the COMsticks only very little. If
    uprinz> you look at the date of the .conf files you see, what
    uprinz> happened. I have a couple of these neat sticks so I can put one
    uprinz> to my station and update the configuration for you.

Yes, nut/conf/stm32-comStick.conf is outdated

    uprinz> Uwe Bonnes wrote:
    >>  arm-gcc -v Using built-in specs.  Target: arm-unknown-eabi ...  gcc
    >> version 4.4.6 (crosstool-NG-hg_default at 2410_3954053fb678)
    >> 

Using the right compiler (-mcm3-gcc) and the right conf file
(nut/conf/stm3210c-eval.conf) looks much better.

However either I have to remove "-Wstrict-prototypes -Werror" from
nut/Makevars.cm3-gcc to get around the strict aliasing warnings. Or I
rewrite nut/arch/cm3/cmsis/cortex_init.c as in the patch below. I think,
this is similar to the "AT (ldadr)" section in 
http://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_21.html
Please bear with me if the cortex_init patch is totaly bogus!

Furthermore nut/app/led_key/pbtest.c has some bad line.

With the changes applied, I can compile the library and the examples.

Thanks so long!

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: ../../nut/app/led_key/pbtest.c
===================================================================
--- ../../nut/app/led_key/pbtest.c	(Revision 3385)
+++ ../../nut/app/led_key/pbtest.c	(Arbeitskopie)
@@ -65,7 +65,7 @@
 
 /* This sample application only supports the following boards */
 #if defined(AT91SAM7X_EK) || defined(ENET_SAM7X) || \
-    defined(EVK1100) || defined(EVK1101) || defined(EVK1105) \\
+    defined(EVK1100) || defined(EVK1101) || defined(EVK1105) || \
     defined(STM3210C_EVAL) || defined(STM3210E_EVAL)
 
 
Index: ../../nut/arch/cm3/cmsis/cortex_init.c
===================================================================
--- ../../nut/arch/cm3/cmsis/cortex_init.c	(Revision 3385)
+++ ../../nut/arch/cm3/cmsis/cortex_init.c	(Arbeitskopie)
@@ -90,14 +90,14 @@
  * These pointers are provided by the linker, controlled by the
  * linker script.
  */
-extern void * _etext;       /* Start of constants in FLASH */
-extern void * _sidata;      /* Start of variables in FLASH */
-extern void * _sdata;       /* Start of variables in RAM */
-extern void * _edata;       /* End of variables in RAM */
-extern void * _sbss;        /* Start of unset variables in RAM */
-extern void * _ebss;        /* End of unset variables in RAM */
-extern void * _pspstack_start;
-extern void * _pspstack_end;
+extern uint32_t * _etext;       /* Start of constants in FLASH */
+extern uint32_t * _sidata;      /* Start of variables in FLASH */
+extern uint32_t * _sdata;       /* Start of variables in RAM */
+extern uint32_t * _edata;       /* End of variables in RAM */
+extern uint32_t * _sbss;        /* Start of unset variables in RAM */
+extern uint32_t * _ebss;        /* End of unset variables in RAM */
+extern uint32_t * _pspstack_start;
+extern uint32_t * _pspstack_end;
 
 /*!
  * \brief CortexM3 Initialization.
@@ -107,7 +107,7 @@
  */
 void Cortex_MemInit(void)
 {
-    register uint32_t *src, *dst, *end;
+    register uint32_t *src, *dst;
     register uint32_t fill = 0;
 
     /*
@@ -115,28 +115,23 @@
      */
 
     /* Copy the data segment initializers from flash to SRAM. */
-    src = (uint32_t*)&_etext;
-    end = (uint32_t*)&_edata;
-    for( dst = (uint32_t*)&_sdata; dst < end;)
+    src = _etext;
+    for( dst = _sdata; dst < _edata;)
     {
         *dst++ = *src++;
     }
 
     /* Fill the bss segment with 0x00 */
-    end = (uint32_t*)&_ebss;
-    for( dst = (uint32_t*)&_sbss; dst < end; )
+    for( dst = _sbss; dst < _ebss; )
     {
         *dst++ = fill;
     }
 
     /* Fill the psp_stack segment with 0x00 */
-    end = (uint32_t*)&_pspstack_end;
     for( fill = 0; fill < PSP_STACK_SIZE; fill++)
     {
         pspStack[fill]=0;
     }
-    
-    
 }
 
 /*!



More information about the En-Nut-Discussion mailing list