From 29090a3dda9d122f74d05069dad83042a3954801 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 20 Apr 2012 14:01:32 +0100 Subject: [PATCH] The cc253x Makefile specifies SoC flavor This will help us slowly add better support for smaller SoCs instead of just assuming that all cc253x SoCs are F256 - We build for F256 by default but the project Makefile can override this - We currently ignore this when passing --code-size. This is a ToDo - The bank allocator always assumes 7 banks. Once we fix --code-size above this will be irrelevant --- cpu/cc253x/Makefile.cc253x | 11 +++++++++++ cpu/cc253x/soc.h | 20 +++++++++++++++++++- platform/cc2530dk/contiki-main.c | 16 +--------------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/cpu/cc253x/Makefile.cc253x b/cpu/cc253x/Makefile.cc253x index 568d8f2d9..800574f7a 100644 --- a/cpu/cc253x/Makefile.cc253x +++ b/cpu/cc253x/Makefile.cc253x @@ -15,6 +15,7 @@ BANK_ALLOC = $(CONTIKI_CPU)/bank-alloc.py SEGMENT_RULES = $(OBJECTDIR)/segment.rules CFLAGS += --model-$(MEMORY_MODEL) --stack-auto --std-c99 +CFLAGS += -DCC2530_LAST_FLASH_BANK=$(HIGH_FLASH_BANK) LDFLAGS += --model-$(MEMORY_MODEL) --stack-auto --out-fmt-ihx LDFLAGS += --xram-loc 0x0000 --xram-size 0x1F00 @@ -33,6 +34,16 @@ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ rm -f $(@:.rel=.$$$$) endef +### SoC flavor (F256, F128, F64, F32) as the ID of the last flash bank (0...7) +### We assume F256, project Makefile can override +### +### ToDo: +### Fix --code-size accordingly +### Fix the bank allocator to play for all flavors +ifndef HIGH_FLASH_BANK + HIGH_FLASH_BANK=7 +endif + ### Banking Guesswork: ### Generic examples do not specify banking. ### We automatically turn it on if its unspecified and if we are building with diff --git a/cpu/cc253x/soc.h b/cpu/cc253x/soc.h index 81888e2ab..bcf858ba0 100644 --- a/cpu/cc253x/soc.h +++ b/cpu/cc253x/soc.h @@ -31,7 +31,7 @@ /** * \file - * Header file for cc253x SoC hardware init routines + * Header file with cc253x SoC-specific defines and prototypes * * \author * George Oikonomou - @@ -41,6 +41,24 @@ #ifndef __SOC_H__ #define __SOC_H__ + +#ifndef CC2530_LAST_FLASH_BANK +#define CC2530_LAST_FLASH_BANK 7 /* Default to F256 */ +#endif + +#if CC2530_LAST_FLASH_BANK==7 /* F256 */ +#define CC2530_FLAVOR_STRING "F256" +#elif CC2530_LAST_FLASH_BANK==3 /* F128 */ +#define CC2530_FLAVOR_STRING "F128" +#elif CC2530_LAST_FLASH_BANK==1 /* F64 */ +#define CC2530_FLAVOR_STRING "F64" +#elif CC2530_LAST_FLASH_BANK==0 /* F32 */ +#define CC2530_FLAVOR_STRING "F32" +#else +#error "Unknown SoC Type specified. Check the value of HIGH_FLASH_BANK in your" +#error "Makefile. Valid values are 0, 1, 3, 7" +#endif + void soc_init(); #endif /* __SOC_H__ */ diff --git a/platform/cc2530dk/contiki-main.c b/platform/cc2530dk/contiki-main.c index 88e15020a..3c5cfb49d 100644 --- a/platform/cc2530dk/contiki-main.c +++ b/platform/cc2530dk/contiki-main.c @@ -160,21 +160,7 @@ main(void) break; } - putstring("-F"); - switch(CHIPINFO0 & 0x70) { - case 0x40: - putstring("256, "); - break; - case 0x30: - putstring("128, "); - break; - case 0x20: - putstring("64, "); - break; - case 0x10: - putstring("32, "); - break; - } + putstring("-" CC2530_FLAVOR_STRING ", "); puthex(CHIPINFO1 + 1); putstring("KB SRAM\n");