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
This commit is contained in:
George Oikonomou 2012-04-20 14:01:32 +01:00
parent 4a78021c62
commit 29090a3dda
3 changed files with 31 additions and 16 deletions

View File

@ -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

View File

@ -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 - <oikonomou@users.sourceforge.net>
@ -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__ */

View File

@ -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");