d2q9: replace attribute 'unused' with 'used'
authorSebastian <git@sraa.de>
Wed, 13 Aug 2014 14:28:07 +0000 (14:28 +0000)
committerSebastian <git@sraa.de>
Wed, 13 Aug 2014 14:28:07 +0000 (14:28 +0000)
While the attribute 'unused' only removes a warning, the
attribute 'used' actually prevents the linker from removing
the object. The objects in question are dummy objects to
prevent the linker from even trying to put anything else there.

Change the Makefile to remove the sections in question (banks 1/2/3)
from the SREC file, since they contain uninitialized data anyway.

d2q9/Makefile
d2q9/esrc/main.c
d2q9/shared.h

index e4a6bb85cfa3dcaa18fd59eb2666312f6dcf947e..f4f22ed633ad4d84df37ef0e0fe95634938785b5 100644 (file)
@@ -11,7 +11,7 @@ ECC   = e-gcc
 EOC    = e-objcopy
 ECFLAGS        = -Os -std=c99 -falign-loops=8 -falign-functions=8 -Wall -fsingle-precision-constant -ffast-math
 ELFLAGS        = -T$(EPIPHANY_HOME)/bsps/current/internal.ldf -le-lib
-EOFLAGS        = -R .shared_dram
+EOFLAGS        = -R .shared_dram -R .data_bank1 -R .data_bank2 -R .data_bank3
 
 # host application
 HAPP   = $(DEST)/ep_main
index fbd21ccdf1e21d8ce9ee8371632c898f02c2d539..057fb789b3918fa39914f76161b75b0bf225dbd3 100644 (file)
@@ -13,9 +13,9 @@ volatile shm_t shm SECTION(".shared_dram");
 
 /* statically allocate dummy memory and local block overlay
    to prevent linker from putting stuff in banks 1..3 */
-static uint8_t      dummy_bank1[8192] UNUSED SECTION(".data_bank1");
-static uint8_t      dummy_bank2[8192] UNUSED SECTION(".data_bank2");
-static uint8_t      dummy_bank3[8192] UNUSED SECTION(".data_bank3");
+static uint8_t      dummy_bank1[8192] USED SECTION(".data_bank1");
+static uint8_t      dummy_bank2[8192] USED SECTION(".data_bank2");
+static uint8_t      dummy_bank3[8192] USED SECTION(".data_bank3");
 static d2q9_block_t *block = (void*)0x2000;
 
 /* barrier structures */
index 607a3e183b86f4f2e34a0cd4d52077b309d1f190..7182e93177772bdbd5cc53281fb1896317dfb88e 100644 (file)
@@ -6,7 +6,7 @@
 
 /* preprocessor magic */
 #define BUILD_BUG(c) do { ((void)sizeof(char[1 - 2*!!(c)])); } while(0);
-#define UNUSED __attribute__((unused))
+#define USED __attribute__((used))
 #undef PACKED
 #define PACKED __attribute__((packed))
 #undef ALIGN