From acc1fe923cfc88ba4c2a1564e5cf6c2725c860df Mon Sep 17 00:00:00 2001 From: anthony-a Date: Thu, 21 Jan 2010 15:34:26 +0000 Subject: [PATCH] rules file for assigning code files to specific banks. --- cpu/cc2430/segment.rules | 23 +++++++++++++++++++++++ cpu/cc2430/segment.rules.pl | 11 +++++++++++ 2 files changed, 34 insertions(+) create mode 100644 cpu/cc2430/segment.rules create mode 100644 cpu/cc2430/segment.rules.pl diff --git a/cpu/cc2430/segment.rules b/cpu/cc2430/segment.rules new file mode 100644 index 000000000..f91005099 --- /dev/null +++ b/cpu/cc2430/segment.rules @@ -0,0 +1,23 @@ +# segment.rules file assigns source code modules to specific banks +# segment.rules is constructed from any segment.rules found in the search path +# the search path is defined in Makefile.cc2430 +# segment.rules get processed by a perl snippet listed in the Makefile.cc2430 +# the processed output is put into the obj_* directory +# comments starting with "#" are supported +# perl regular expression matching can be used on the file name specification +# +# general rules -- +# some code must be placed in all banks (or SDCC/aslink will complain at link time) +# code called from function pointers must be in HOME/CSEG/BANK0 +# interrupt code must also be in HOME/CSEG/BANK0 +# code not marked with __banked can only be called from code in the same bank +# +HOME intr.c # All interrupt code must live in HOME/BANK0 +HOME uart.c +BANK3 uart_init.c +BANK2 dma.c +CSEG cc2430/dev/bus.c +CSEG autostart.c +BANK2 cc2430/dev/cc2430_rf.c +BANK1 cc2430/ +BANK1 . diff --git a/cpu/cc2430/segment.rules.pl b/cpu/cc2430/segment.rules.pl new file mode 100644 index 000000000..213dd8fa2 --- /dev/null +++ b/cpu/cc2430/segment.rules.pl @@ -0,0 +1,11 @@ + $match_me = pop @ARGV; + #print "searching for $match_me\n"; + while (<>) { + s/#.*$//; # filter out comments + s/^\s*//; # filter out leading white space + @F=split /\s+/; # split on white space + if (($_ =~ m/\S\s+\S/) && ($match_me =~ m/$F[1]/)) { + print $F[0]."\n"; + exit; #return only first match + } + }