]> oss.titaniummirror.com Git - msp430-libc.git/blobdiff - src/stdlib/_init_section__.c
Imported msp430-libc-20100207
[msp430-libc.git] / src / stdlib / _init_section__.c
index b72981128f33120c46ebeac0100f9cb667ab7178..6493cc356c62867ef4c3a946a1111184ddd0d258 100644 (file)
 int _init_section__(int section)
 {
   uint16_t start, stop, size, stack, ret = 0;
-  void *from, *where;
+  char *from, *where;
 
   if(section == MSP430_SECTION_BSS)
   {
-      (uint16_t *)start = &__bss_start;
-      (uint16_t *)stop  = &__bss_end;
+      start = (uint16_t)&__bss_start;
+      stop  = (uint16_t)&__bss_end;
       bzero(&__bss_start,stop-start);
       return ret;
   } 
   else if(section == MSP430_SECTION_DATA)
   {
-      (uint16_t *)start = &__data_start_rom;
-      (uint16_t *)stop  = &_edata;
-      from = (void *)&_etext;
-      where = (void *)&__data_start;
+      start = (uint16_t)&__data_start_rom;
+      stop  = (uint16_t)&_edata;
+      from = (char *)&_etext;
+      where = (char *)&__data_start;
       size = ret = stop - start;
   }
   else if(section == MSP430_SECTION_NOINIT)
   {
-      (uint16_t *)start = &__noinit_start_rom;
-      (uint16_t *)stop  = &__noinit_end_rom;
-      from = (void *)&__noinit_start_rom;
-      where = (void *)&__bss_end;
+      start = (uint16_t)&__noinit_start_rom;
+      stop  = (uint16_t)&__noinit_end_rom;
+      from = (char *)&__noinit_start_rom;
+      where = (char *)&__bss_end;
       size = ret = stop - start;
   }   
   else
@@ -69,7 +69,7 @@ int _init_section__(int section)
   
   while(size--)
   {
-    *((char *)where)++ = *((char *)from)++;
+    *(where)++ = *(from)++;
   }
   
   return ret;