]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Linker problems for CW fixed
authormahi <devnull@localhost>
Wed, 29 Jun 2011 21:14:31 +0000 (23:14 +0200)
committermahi <devnull@localhost>
Wed, 29 Jun 2011 21:14:31 +0000 (23:14 +0200)
arch/ppc/mpc55xx/drivers/Mcu.c
arch/ppc/mpc55xx/scripts/linkscript_cw.ldf
include/MemMap.h
scripts/cc_cw.mk
system/kernel/init.c

index aa93a72f8936a28238c7b2e78fdffee531eb1b6b..d9d0c1a278c478d0a35a1f5bb69ca0c85963882a 100644 (file)
@@ -146,7 +146,7 @@ typedef struct{
        uint32 pvr;\r
 } cpu_info_t;\r
 \r
-cpu_info_t cpu_info_list[] = {\r
+const cpu_info_t cpu_info_list[] = {\r
 #if defined(CFG_MPC5516)\r
     {\r
        .name = "MPC5516",\r
@@ -174,7 +174,7 @@ cpu_info_t cpu_info_list[] = {
 #endif\r
 };\r
 \r
-core_info_t core_info_list[] = {\r
+const core_info_t core_info_list[] = {\r
 #if defined(CFG_MPC5516)\r
        {\r
                .name = "CORE_E200Z1",\r
@@ -207,7 +207,7 @@ core_info_t core_info_list[] = {
 #define ARRAY_SIZE(_x)  (sizeof(_x)/sizeof((_x)[0]))\r
 #endif\r
 \r
-static cpu_info_t *Mcu_IdentifyCpu(uint32 pvr)\r
+static const cpu_info_t *Mcu_IdentifyCpu(uint32 pvr)\r
 {\r
     int i;\r
 \r
@@ -220,7 +220,7 @@ static cpu_info_t *Mcu_IdentifyCpu(uint32 pvr)
     return NULL;\r
 }\r
 \r
-static core_info_t *Mcu_IdentifyCore(uint32 pvr)\r
+static const core_info_t *Mcu_IdentifyCore(uint32 pvr)\r
 {\r
        int i;\r
 \r
@@ -236,8 +236,8 @@ static core_info_t *Mcu_IdentifyCore(uint32 pvr)
 static uint32 Mcu_CheckCpu( void ) {\r
        uint32 pvr;\r
        uint32 pir;\r
-       cpu_info_t *cpuType;\r
-       core_info_t *coreType;\r
+       const cpu_info_t *cpuType;\r
+       const core_info_t *coreType;\r
 \r
     // We have to registers to read here, PIR and PVR\r
     pir = get_spr(SPR_PIR);\r
index a0bb9219cf5d5dc6dd40e6a0b91c47bd39d895e4..41a27ab5d5b7e04691c323651a48083f133b3560 100644 (file)
@@ -44,12 +44,14 @@ SECTIONS
            extab      : {}  \r
            extabindex : {}\r
         .sdata2     : {}   /* SHF_ALLOC + possibly SHF_WRITE (prob. ReadOnly)*/\r
-        .sbss2      : {}      /* SHF_ALLOC +  SHF_WRITE , e.g const int apa = 0;*/\r
-           . = ALIGN(0x10);\r
+        .sbss2      : {}   /* SHF_ALLOC +  SHF_WRITE , e.g const int apa = 0;*/\r
+           . = ALIGN(0x10);   /* Section alignment is 0x10 */  \r
            __DATA_ROM = .;\r
            .=.+SIZEOF(.data);\r
+           . = ALIGN(0x10);  /* Section alignment is 0x10 */\r
            __SDATA = .;\r
            .=.+SIZEOF(.sdata);\r
+           . = ALIGN(0x10);  /* Section alignment is 0x10 */\r
            __SDATA0 = .;\r
            .=.+SIZEOF(.PPC.EMB.sdata0);\r
         }       > flash\r
@@ -68,7 +70,7 @@ SECTIONS
          __BSS_END = .;\r
       .PPC.EMB.sdata0 LOAD(ADDR(__SDATA0)) : {}        /* Small data with offset to 0 */           \r
       .PPC.EMB.sbss0  : {}\r
-      .ramlog (DATA) : { *(.ramlog) }\r
+      .ramlog : { *(.ramlog_data) *(.ramlog_bss) }\r
          _heap_addr = .;      \r
        } > sram\r
 }   \r
index aa0a1f90dc20f75225039fa62cca3af5614795ae..c72ae6262f09ae8ec11c75b18a3e374bba0d0f6e 100644 (file)
@@ -22,8 +22,6 @@
  *
  */\r
 \r
-\r
-\r
 #if defined(__GNUC__)\r
 \r
    #define SECTION_RAMLOG      __attribute__ ((section (".ramlog")))\r
 \r
 #elif defined(__CWCC__)\r
 \r
-   #pragma section RW ".ramlog" ".ramlog"\r
+/* The compiler manual states:\r
+ *   The section name specified in the\r
+ *   __declspec(section <section_name>) statement must be the\r
+ *   name of an initialized data section.  It is an error to use the uninitialized\r
+ *   data section name.\r
+ *\r
+ * NOTE!! The initialized data section name is __declspec() does not mean that\r
+ *        it will end up in that section, if its BSS data it will end-up in\r
+ *        ramlog_bss instead.\r
+ *\r
+ * NOTE!! Naming the initialized and uninitialized data section to the same\r
+ *        name will generate strange linker warnings (sometimes)\r
+ */\r
 \r
-   #define SECTION_RAMLOG      __declspec(section ".ramlog")\r
+   #pragma section RW ".ramlog_data" ".ramlog_bss"\r
+   #define SECTION_RAMLOG      __declspec(section ".ramlog_data")\r
 \r
 \r
 #endif\r
index 105fc650e3177377ca6c152492e0444c16bb349d..19abc2764fe407e06b626f768c735b25badc3bbe 100644 (file)
@@ -48,7 +48,8 @@ cflags-y          += -abi=eabi
 cflags-y          += -proc=5565\r
 cflags-y          += -fp=soft\r
 cflags-y          += -use_isel=on\r
-cflags-y          += -sdata=0xFFFF -sdata2=16\r
+#cflags-y          += -sdata=0xFFFF -sdata2=16\r
+cflags-y          += -sdata=0xFFFF -sdata2=0\r
 \r
 #cflags-y          += -fno-strict-aliasing\r
 #cflags-y          += -fno-builtin\r
index 64ff6a3a1685bb56598bcf2b25718dc6fa66b2fb..870197b400851609fc57772700bf2638dcb39dca 100644 (file)
@@ -247,18 +247,49 @@ static void os_start( void ) {
 }\r
 #endif\r
 \r
-#define TEST_DATA  12345\r
-int test_data = TEST_DATA;\r
-int test_bss = 0;\r
+#define TEST_DATA  0x12345\r
+#define TEST_SDATA2    0x3344\r
+volatile int test_data = TEST_DATA;\r
+volatile int test_bss = 0;\r
+#if defined(CFG_PPC) && defined(__CWCC__)\r
+/* Note! It does not matter if the data is initialized to 0,\r
+ * it still sbss2.
+ */\r
+volatile const int test_sbss2;\r
 \r
+/* Initialized small data */\r
+volatile const int test_sdata2 = TEST_SDATA2;\r
+#endif\r
 \r
-void noooo( void ) {\r
-       while(1) {}\r
-}\r
+\r
+#define BAD_LINK_FILE()        while(1) {}\r
 \r
 extern void EcuM_Init();\r
 int main( void )\r
 {\r
+       /* Check link file */\r
+       if (TEST_DATA != test_data) {\r
+               BAD_LINK_FILE();\r
+       }\r
+\r
+       if (test_bss != 0) {\r
+               BAD_LINK_FILE();\r
+       }\r
+\r
+#if defined(CFG_PPC) && defined(__CWCC__)\r
+       /* check sdata2 */\r
+       if (test_sdata2 != TEST_SDATA2) {\r
+               BAD_LINK_FILE();\r
+       }\r
+#endif\r
+\r
+#if defined(CFG_PPC) && defined(__CWCC__)\r
+       /* check sdata2 */\r
+       if (test_sbss2 != 0) {\r
+               BAD_LINK_FILE();\r
+       }\r
+#endif\r
+\r
        EcuM_Init();\r
 \r
 }\r
@@ -271,15 +302,6 @@ int main( void )
  */\r
 void StartOS(AppModeType Mode) {\r
 \r
-       /* Check link file */\r
-       if (TEST_DATA != test_data) {\r
-               noooo();\r
-       }\r
-\r
-       if (test_bss != 0) {\r
-               noooo();\r
-       }\r
-\r
        Os_Sys.appMode = Mode;\r
 \r
        Os_CfgValidate();\r