From: Sebastian Date: Wed, 13 Aug 2014 14:28:07 +0000 (+0000) Subject: d2q9: replace attribute 'unused' with 'used' X-Git-Url: http://sraa.de/git/?a=commitdiff_plain;h=9e2a49e95dd1e38b849ed06ebb6b86969132362b;p=lattice-boltzmann-epiphany.git d2q9: replace attribute 'unused' with 'used' 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. --- diff --git a/d2q9/Makefile b/d2q9/Makefile index e4a6bb8..f4f22ed 100644 --- a/d2q9/Makefile +++ b/d2q9/Makefile @@ -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 diff --git a/d2q9/esrc/main.c b/d2q9/esrc/main.c index fbd21cc..057fb78 100644 --- a/d2q9/esrc/main.c +++ b/d2q9/esrc/main.c @@ -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 */ diff --git a/d2q9/shared.h b/d2q9/shared.h index 607a3e1..7182e93 100644 --- a/d2q9/shared.h +++ b/d2q9/shared.h @@ -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