[Tinyos8051wg-commit] SF.net SVN: tinyos8051wg:[1095] trunk/diku
Status: Alpha
Brought to you by:
mleopold
From: <mle...@us...> - 2009-10-05 19:47:18
|
Revision: 1095 http://tinyos8051wg.svn.sourceforge.net/tinyos8051wg/?rev=1095&view=rev Author: mleopold Date: 2009-10-05 19:47:07 +0000 (Mon, 05 Oct 2009) Log Message: ----------- Updating xdata variables to use the more mangling robust __attribute((xdata)) construct Modified Paths: -------------- trunk/diku/common/apps/CompressionTest/CompressionTestM.nc trunk/diku/common/apps/Echo/EchoP.nc trunk/diku/common/apps/TestAll/TestAppP.nc trunk/diku/common/lib/usb/usb-cdc.h trunk/diku/common/lib/usb/usb.h trunk/diku/common/tools/compression/buffer.c trunk/diku/common/tools/compression/lz77/lz77_comp.c trunk/diku/common-private/apps/DataAcquisition/DataAcquisitionP.nc trunk/diku/common-private/apps/DataAcquisitionAdv2/DataAcquisitionAdvP.nc trunk/diku/common-private/apps/DataAcquisitionAdv2MacDuty/DataAcquisitionAdvP.nc trunk/diku/common-private/apps/DataAcquisitionMac/DataAcquisitionP.nc trunk/diku/common-private/apps/DataAcquisitionMacDuty/DataAcquisitionP.nc trunk/diku/common-private/apps/PrintfTester/PrintfTesterP.nc trunk/diku/common-private/apps/SampleStoreForward/SampleStoreForwardP.nc trunk/diku/common-private/apps/TestSeqFlash/TestAppP.nc trunk/diku/common-private/apps/UartStreamTester/UartStreamTesterP.nc trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl trunk/diku/mcs51/tos/chips/cc2430/cc2420/HplCC2430RadioP.nc trunk/diku/mcs51/tos/chips/cc2430/flash/HalFlashP.nc trunk/diku/mcs51/tos/chips/cc2430/ioCC2430.h trunk/diku/mcs51/tos/chips/cc2430/radio/HalCC2430RadioP.nc trunk/diku/mcs51/tos/chips/cc2430/radio/HplCC2430RadioC.nc trunk/diku/mcs51/tos/chips/mcs51/io8051.h trunk/diku/mcs51-private/apps/Test2430All/TestAppP.nc trunk/diku/mcs51-private/apps/Test2430DMA/TestCC2430P.nc trunk/diku/mcs51-private/apps/Test2430Flash/TestCC2430P.nc trunk/diku/mcs51-private/apps/Test2430HPL/RadioTestP.nc Modified: trunk/diku/common/apps/CompressionTest/CompressionTestM.nc =================================================================== --- trunk/diku/common/apps/CompressionTest/CompressionTestM.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/apps/CompressionTest/CompressionTestM.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -66,11 +66,10 @@ enum state_t state; - uint8_t recv_buffer[258] __attribute((xdata)); // 256 bytes + 2 bytes for CRC + uint8_t __attribute((xdata)) recv_buffer[258]; // 256 bytes + 2 bytes for CRC uint16_t recv_pos; - //uint8_t memory_buffer[4096]; - uint8_t memory_buffer[4096] __attribute((xdata)); + uint8_t __attribute((xdata)) memory_buffer[4096]; uint8_t buffers = sizeof(memory_buffer) / 256; uint16_t memslot; @@ -115,7 +114,7 @@ return SUCCESS; } - uint8_t tmp_buffer[259] __attribute((xdata)); + uint8_t __attribute((xdata)) tmp_buffer[259]; bool halt_compression = FALSE; uint16_t do_compress_memslot; uint8_t do_compress_pos; Modified: trunk/diku/common/apps/Echo/EchoP.nc =================================================================== --- trunk/diku/common/apps/Echo/EchoP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/apps/Echo/EchoP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -35,6 +35,9 @@ * @author Martin Leopold <le...@di...> */ +//#define _XIXX(addr) (*(( uint8_t __attribute((sfr))*) addr)) +#define _XIXX(addr) (*(( uint8_t *) addr)) + module EchoP { uses { interface Boot; @@ -54,6 +57,7 @@ } event void Boot.booted() { + _XIXX(0x86) = 0xFF; call Leds.led0On(); call uart0.put(buf); } Modified: trunk/diku/common/apps/TestAll/TestAppP.nc =================================================================== --- trunk/diku/common/apps/TestAll/TestAppP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/apps/TestAll/TestAppP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -76,9 +76,9 @@ #endif #ifdef __cc2430__ -#define FLASH_BASE (uint8_t_xdata *) 0x7B00 +#define FLASH_BASE (uint8_t __attribute((xdata)) *) 0x7B00u #elif __micro4__ -#define FLASH_BASE (uint8_t *) 0xF100 +#define FLASH_BASE (uint8_t *) 0xF100u #endif /*****************************************************************************/ @@ -110,10 +110,10 @@ transmitPacketPtr = (packet_t *) transmitPacket; // Beacon packet - transmitPacketPtr->length = 127; //7 + 118 + 2; - transmitPacketPtr->fcf = 0x0000; + transmitPacketPtr->length = 127u; //7 + 118 + 2; + transmitPacketPtr->fcf = 0x0000u; transmitPacketPtr->data_seq_no = sequence++; - transmitPacketPtr->dest = 0xFFFF; + transmitPacketPtr->dest = 0xFFFFu; transmitPacketPtr->src = 0; /* // 118 bytes Modified: trunk/diku/common/lib/usb/usb-cdc.h =================================================================== --- trunk/diku/common/lib/usb/usb-cdc.h 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/lib/usb/usb-cdc.h 2009-10-05 19:47:07 UTC (rev 1095) @@ -19,14 +19,14 @@ uint8_t databit; // Data bits: 5, 6, 7, 8, 16 } line_coding_t; -const line_coding_t cdc_230400_8n1 __attribute__((code)) = { +const line_coding_t __attribute__((code)) cdc_230400_8n1 = { hostToUsb32(230400), // baudrate 0, // stop bit: 1 0, // parity: none 8 // data bits: 8 }; -const line_coding_t cdc_9600_8n1 __attribute__((code)) = { +const line_coding_t __attribute__((code)) cdc_9600_8n1 = { hostToUsb32(9600), // baudrate 0, // stop bit: 1 0, // parity: none Modified: trunk/diku/common/lib/usb/usb.h =================================================================== --- trunk/diku/common/lib/usb/usb.h 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/lib/usb/usb.h 2009-10-05 19:47:07 UTC (rev 1095) @@ -166,7 +166,7 @@ #define DSC_NUM_STRING 4 #define DEV_REV 0x0000 -const usb_device_descriptor_t MyDeviceDesc __attribute__((code)) = { +const usb_device_descriptor_t __attribute__((code)) MyDeviceDesc = { 18, //sizeof(usb_device_descriptor_t), USB_DESCRIPTOR_TYPE_DEVICE, @@ -276,7 +276,7 @@ #define DSC_EP_BULK 0x02 #define DSC_EP_INTERRUPT 0x03 -const configuration_desc_set_t MyConfigDescSet __attribute__((code)) = { +const configuration_desc_set_t __attribute__((code)) MyConfigDescSet = { { // Configuration descriptor sizeof(configuration_descriptor_t), // bLength USB_DESCRIPTOR_TYPE_CONFIG, // bDescriptorType @@ -363,13 +363,13 @@ }; //end of Configuration #define STR0LEN 4 -const uint8_t String0Desc[STR0LEN] __attribute__((code)) = { +const uint8_t __attribute__((code)) String0Desc[STR0LEN] = { STR0LEN, USB_DESCRIPTOR_TYPE_STRING, 0x09, 0x04 }; #define STR1LEN sizeof("Polaric")*2 -const uint8_t String1Desc[STR1LEN] __attribute__((code)) = { +const uint8_t __attribute__((code)) String1Desc[STR1LEN] = { STR1LEN, USB_DESCRIPTOR_TYPE_STRING, 'P', 0, 'o', 0, @@ -381,7 +381,7 @@ }; #define STR2LEN sizeof("SWM1702DK")*2 -const uint8_t String2Desc[STR2LEN] __attribute__((code)) = { +const uint8_t __attribute__((code)) String2Desc[STR2LEN] = { STR2LEN, USB_DESCRIPTOR_TYPE_STRING, 'S', 0, 'W', 0, @@ -396,7 +396,7 @@ #define STR3LEN sizeof("0001")*2 -const uint8_t String3Desc[STR3LEN] __attribute__((code))= { +const uint8_t __attribute__((code)) String3Desc[STR3LEN] = { STR3LEN, USB_DESCRIPTOR_TYPE_STRING, '0', 0, '0', 0, @@ -404,15 +404,15 @@ '1', 0 }; -const uint8_t *StringDescTable[4] __attribute__((code)) = { +const uint8_t __attribute__((code)) *StringDescTable[4] = { String0Desc, String1Desc, String2Desc, String3Desc }; -const uint8_t OnesPacket[2] __attribute__((code)) = {1,0}; -const uint8_t ZerosPacket[2] __attribute__((code)) = {1,0}; +const uint8_t __attribute__((code)) OnesPacket[2] = {1,0}; +const uint8_t __attribute__((code)) ZerosPacket[2] = {1,0}; /* typedef struct { */ /* configuration_descriptor_t ConfigDescriptor; */ @@ -421,7 +421,7 @@ /* endpoint_descriptor_t EndpointDescriptor1; */ /* } USB_CONFIG_DATA; */ -/* const USB_CONFIG_DATA ConfigurationDescriptor __attribute((code)) = { */ +/* const USB_CONFIG_DATA __attribute((code)) ConfigurationDescriptor = { */ /* { /\* configuration descriptor *\/ */ /* sizeof(configuration_descriptor_t), /\* bLength *\/ */ /* USB_DESCRIPTOR_TYPE_CONFIG, /\* bDescriptorType *\/ */ Modified: trunk/diku/common/tools/compression/buffer.c =================================================================== --- trunk/diku/common/tools/compression/buffer.c 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/tools/compression/buffer.c 2009-10-05 19:47:07 UTC (rev 1095) @@ -17,7 +17,7 @@ # define assert(x) #endif -uint8_t membuffer[MEMBUFSIZE] __attribute((xdata)); +uint8_t __attribute((xdata)) membuffer[MEMBUFSIZE]; uint8_t *buf_pos; uint8_t write_bits_used; Modified: trunk/diku/common/tools/compression/lz77/lz77_comp.c =================================================================== --- trunk/diku/common/tools/compression/lz77/lz77_comp.c 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common/tools/compression/lz77/lz77_comp.c 2009-10-05 19:47:07 UTC (rev 1095) @@ -20,7 +20,7 @@ #include <string.h> -uint8_t window[WINDOW_SIZE] __attribute((xdata)); +uint8_t __attribute((xdata)) window[WINDOW_SIZE]; uint8_t *search_start = window ; uint8_t *search_end = window ; /* Doubles as look_ahead_start */ uint8_t *look_ahead_end = window; Modified: trunk/diku/common-private/apps/DataAcquisition/DataAcquisitionP.nc =================================================================== --- trunk/diku/common-private/apps/DataAcquisition/DataAcquisitionP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/DataAcquisition/DataAcquisitionP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -73,12 +73,12 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u #elif __micro4__ -#define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define TIMER_2_SECONDS 2048u +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u #endif #define TIMER_INTERVAL TIMER_2_SECONDS/20 Modified: trunk/diku/common-private/apps/DataAcquisitionAdv2/DataAcquisitionAdvP.nc =================================================================== --- trunk/diku/common-private/apps/DataAcquisitionAdv2/DataAcquisitionAdvP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/DataAcquisitionAdv2/DataAcquisitionAdvP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -28,14 +28,14 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 - uint8_t_xdata sourcepage[256]; - uint8_t_xdata readbuf[256]; +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u + uint8_t __attribute((xdata)) sourcepage[256]; + uint8_t __attribute((xdata)) readbuf[256]; #elif __micro4__ #define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u uint8_t sourcepage[256]; uint8_t readbuf[256]; #endif Modified: trunk/diku/common-private/apps/DataAcquisitionAdv2MacDuty/DataAcquisitionAdvP.nc =================================================================== --- trunk/diku/common-private/apps/DataAcquisitionAdv2MacDuty/DataAcquisitionAdvP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/DataAcquisitionAdv2MacDuty/DataAcquisitionAdvP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -29,14 +29,14 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 - uint8_t_xdata sourcepage[256]; - uint8_t_xdata readbuf[256]; +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u + uint8_t __attribute((xdata)) sourcepage[256]; + uint8_t __attribute((xdata)) readbuf[256]; #elif __micro4__ -#define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define TIMER_2_SECONDS 2048u +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u uint8_t sourcepage[256]; uint8_t readbuf[256]; #endif Modified: trunk/diku/common-private/apps/DataAcquisitionMac/DataAcquisitionP.nc =================================================================== --- trunk/diku/common-private/apps/DataAcquisitionMac/DataAcquisitionP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/DataAcquisitionMac/DataAcquisitionP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -73,12 +73,12 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u #elif __micro4__ #define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u #endif #define TIMER_INTERVAL TIMER_2_SECONDS/10 Modified: trunk/diku/common-private/apps/DataAcquisitionMacDuty/DataAcquisitionP.nc =================================================================== --- trunk/diku/common-private/apps/DataAcquisitionMacDuty/DataAcquisitionP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/DataAcquisitionMacDuty/DataAcquisitionP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -73,12 +73,12 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u #elif __micro4__ #define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u #endif #define TIMER_INTERVAL TIMER_2_SECONDS/20 Modified: trunk/diku/common-private/apps/PrintfTester/PrintfTesterP.nc =================================================================== --- trunk/diku/common-private/apps/PrintfTester/PrintfTesterP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/PrintfTester/PrintfTesterP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -4,7 +4,7 @@ uses interface Boot; } implementation { - char *s __attribute__((code)) = "Hello World\n\r"; + char __attribute__((code)) *s = "Hello World\n\r"; task void doStuff() { } Modified: trunk/diku/common-private/apps/SampleStoreForward/SampleStoreForwardP.nc =================================================================== --- trunk/diku/common-private/apps/SampleStoreForward/SampleStoreForwardP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/SampleStoreForward/SampleStoreForwardP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -72,12 +72,12 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u #elif __micro4__ #define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u #endif #define TIMER_INTERVAL TIMER_2_SECONDS/20 Modified: trunk/diku/common-private/apps/TestSeqFlash/TestAppP.nc =================================================================== --- trunk/diku/common-private/apps/TestSeqFlash/TestAppP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/TestSeqFlash/TestAppP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -23,14 +23,14 @@ #ifdef __cc2430em__ #define TIMER_2_SECONDS 968058UL -#define FLASH_READ_ADDRESS (uint8_t_xdata*) 0x7B00 -#define FLASH_ADDRESS (uint8_t *) 0x7B00 - uint8_t_xdata sourcepage[256]; - uint8_t_xdata readbuf[256]; +#define FLASH_READ_ADDRESS (uint8_t __attribute((xdata))*) 0x7B00u +#define FLASH_ADDRESS (uint8_t *) 0x7B00u + uint8_t __attribute((xdata)) sourcepage[256]; + uint8_t __attribute((xdata)) readbuf[256]; #elif __micro4__ -#define TIMER_2_SECONDS 2048 -#define FLASH_READ_ADDRESS (uint8_t *) 0xF100 -#define FLASH_ADDRESS (uint8_t *) 0xF100 +#define TIMER_2_SECONDS 2048u +#define FLASH_READ_ADDRESS (uint8_t *) 0xF100u +#define FLASH_ADDRESS (uint8_t *) 0xF100u uint8_t sourcepage[256]; uint8_t readbuf[256]; #endif Modified: trunk/diku/common-private/apps/UartStreamTester/UartStreamTesterP.nc =================================================================== --- trunk/diku/common-private/apps/UartStreamTester/UartStreamTesterP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/common-private/apps/UartStreamTester/UartStreamTesterP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -3,7 +3,7 @@ uses interface Boot; } implementation { - char *s __attribute__((code)) = "Hello World\n\r"; + char __attribute__((code)) *s = "Hello World\n\r"; task void doStuff() { call UartStream.send((uint8_t*)s, 13); Modified: trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl =================================================================== --- trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl 2009-10-05 19:47:07 UTC (rev 1095) @@ -141,16 +141,6 @@ # # Replace sfr related definitions with non ANSI-C dialekts # - # Kill the dummy typedef's - # REPLACED! - # s{^(typedef uint8_t sfr;)}{//$1}; - # s{^(typedef uint16_t sfr16;)}{//$1}; - # s{^(typedef uint8_t sbit;)}{//$1}; - # Should these be replaced to please CIL? - s{^(typedef uint8_t uint8_t_xdata;)}{//$1}; - s{^(typedef uint16_t uint16_t_xdata;)}{//$1}; - s{^(typedef uint8_t uint8_t_code;)}{//$1}; - s{^(typedef uint16_t uint16_t_code;)}{//$1}; # Replace # uint8_t volatile P0 __attribute((sfrAT0x86)) @@ -190,52 +180,59 @@ $_ = $_ . "#include \"stdbool.h\"\n"; } - # Replace dummy code types with type and storrage class specifier - s{uint(8|16)_t_code}{uint$1_t code}g; # -# Remove string.h definitions (memset, memcpy, strnlen, ..). Get Keil versions from string.h -# +# Replace memory-specifier mangling +# - # Replaced by custom string.h - # - # if( $string_h_match==1 || - # /^.*extern size_t strlen\(/ || - # /^.*extern void \*memset\(/ || - # /^.*extern void \*memcpy\(/ - # ) { - # $_ = "//" . $_; - # $string_h_match=1; - # if ($string_h_seen == 0) { - # $string_h_seen = 1; - # $_ = $_ . "#include <string.h>\n" ; - # } - # } - # # look for the ")" and ";" of the function - # if ($string_h_match==1 && /^.*\).*;.*/) { - # $string_h_match=0; - # } - # + # In the following we define a few strategies for extending + # variables with memory-specifier information. Each of the + # strategies add additional tags to the variables, but have + # different implications in the suite of tools run on the code + # (Nesc, CIL). + # + # The memory specifiers are used in a number of places. First they + # can be used to force a particular variable to a certain location, + # second they can be used to specify the storrage class on the fly + # (for register access). + # Below are 3 alternative strategies 1 and 2 are implemented (see + # for example ioCC2430.h for more): + # + # 1. Define typedef'ed data types and type cast addresses using this + # datatype. Later this is mangled to the correct syntax. The + # drawback is that it seems that sometimes CIL (the inliner) seems + # to be too clever and replace the typedef'ed type with the original. + # *(uint8_t_xdata* 0x??) = xx + # + # 2. Use the attribute syntax all the way and create an expression + # similar to GCC. This unfortunate seems to clash with the + # typeforwading from CIL making it produce an extra type forward + # that fails in Keil on certain occations (e.g. if an extra (int) is + # inserted this becomes (int xdata) which Keil does not accept). + # *(uint8_t __attribute((xdata)) *) 0x?? = xx + # + # 3. As above define a list of global variables these as variables + # with absolute locations: + # uint8_t xdata MDMCTRL0H_VAR at addr; + # + # Note: these variables should probably be marked volatile, but + # unfortunately this seems to clash with CIL in the same way as 2) + # (i.e. (int) becomes (int volatile) which is not accepted by Keil) + # + # + # -# Replace uint8_t_xdata types with real types these are used to -# on-the-fly access to specific memory locations in name memory -# areas. This is usefull to address registers in say xdata memory in a -# way that looks slightly like ansi-C. -# -# (*(uint16_t_xdata*)) = ? -# -# As an alternative you could imagine defining these as variables -# with absolute locations: -# uint8_t xdata MDMCTRL0H_VAR at addr; -# -# However mangling this in a compiler agnostic way is probaby more -# difficult than stickting to something that looks like ANSI-C -# -# - $memory_att_match = 0; - # Replace dummy xdata types with type and storrage class specifier + # Kill the dummy typedef's + # Should these be replaced to please CIL? + s{^(typedef uint8_t uint8_t_xdata;)}{//$1}; + s{^(typedef uint16_t uint16_t_xdata;)}{//$1}; + s{^(typedef uint8_t uint8_t_code;)}{//$1}; + s{^(typedef uint16_t uint16_t_code;)}{//$1}; + + # Replace dummy code/xdata types with type and storrage class specifier + s{uint(8|16)_t_code}{uint$1_t code}g; if ($KEIL && s{uint(8|16)_t_xdata}{uint$1_t xdata}g) { $memory_att_match = 1; # Don't replace data with _data } @@ -249,20 +246,23 @@ # For Keil the small memory model puts all variables in data # the large model all goes in xdata # -# Replace uint8_t j __attribute((xdata)); with -# Keil, SDCC: uint8_t xdata j; -# IAR : uint8_t __xdata j; +# Replace __attribute((xdata)) with xdata (or __xdata for IAR/SDCC) +# This handles two cases in which memory segment ideintifiers are +# used (i.e. manual variable placement and direct xdata access): +# +# uint8_t __attribute((xdata)) j; +# *(uint8_t __attribute((xdata)) *) 0xxx = ? if( ($KEIL ) && - s{\s+((?:\w)+(?:\[(?:.*)\])?)\s+__attribute(?:__)?\(\((?:__)?((?:x|p)?data|code)(?:__)?\)\)} - { $2 $1} ) { + s{__attribute_*\(\(_*((?:x|p)?data|code)_*\)\)} + {$1}g ) { $memory_att_match = 1; # Dont replace with _data later on } if( ( $IAR || $SDCC) && - s{\s+(.*)\s+__attribute(?:__)?\(\((?:__)?((?:x|p)?data|code)(?:__)?\)\)} - { __$2 $1} ) { # Drop types and rely on default for now.. + s{__attribute_*\(\(_*((?:x|p)?data|code)_*\)\)} + {__$1} ) { $memory_att_match = 1; # Dont replace with _data later on } Modified: trunk/diku/mcs51/tos/chips/cc2430/cc2420/HplCC2430RadioP.nc =================================================================== --- trunk/diku/mcs51/tos/chips/cc2430/cc2420/HplCC2430RadioP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/tos/chips/cc2430/cc2420/HplCC2430RadioP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -209,12 +209,12 @@ // The generic-module system does not allow pointers, so we cast a bit async command cc2420_status_t Reg.read[ uint16_t addr ]( uint16_t* data ) { - *data = *((uint16_t_xdata*) addr); + *data = *((uint16_t __attribute((xdata))*) addr); return SUCCESS; } async command cc2420_status_t Reg.write[ uint16_t addr ]( uint16_t data ) { - *((uint16_t_xdata*) addr) = data; + *((uint16_t __attribute((xdata))*) addr) = data; return SUCCESS; } Modified: trunk/diku/mcs51/tos/chips/cc2430/flash/HalFlashP.nc =================================================================== --- trunk/diku/mcs51/tos/chips/cc2430/flash/HalFlashP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/tos/chips/cc2430/flash/HalFlashP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -50,9 +50,9 @@ ** eraseFlashProcStart/eraseFlashProcEnd and eraseFlashProcStart/ ** eraseFlashProcEnd need to be inserted **************************************************************************/ - uint8_t_xdata eraseFunctionBuffer[] = + uint8_t __attribute((xdata)) eraseFunctionBuffer[] = { 0x75, 0xAE, 0x01, 0x00, 0xE5, 0xAE, 0x54, 0x80, 0x70, 0xFA, 0x22 }; - uint8_t_xdata writeFunctionBuffer[] = + uint8_t __attribute((xdata)) writeFunctionBuffer[] = { 0x7B, 0x01, 0x10, 0xAF, 0x02, 0x7B, 0x00, 0xC0, 0x83, 0xC0, 0x82, 0xC0, 0x85, 0xC0, 0x84, 0xC0, 0x92, 0xEA, 0xF5, 0x83, 0xE9, 0xF5, 0x82, 0x75, 0x92, 0x00, 0xE5, 0xAE, 0x54, 0x80, @@ -79,7 +79,8 @@ command error_t HalFlash.read(uint8_t * destination, uint8_t * source, uint16_t length) { - memcpy((uint8_t_xdata*)destination, (uint8_t_xdata*)source, length); + memcpy((uint8_t __attribute((xdata))*)destination, + (uint8_t __attribute((xdata))*)source, length); return SUCCESS; } Modified: trunk/diku/mcs51/tos/chips/cc2430/ioCC2430.h =================================================================== --- trunk/diku/mcs51/tos/chips/cc2430/ioCC2430.h 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/tos/chips/cc2430/ioCC2430.h 2009-10-05 19:47:07 UTC (rev 1095) @@ -417,101 +417,117 @@ * The registers are not double buffered (latched) and thus the * read/write order does not make a difference. * + * Below are a few strategies to mangling this * - * As an alternative you could imagine defining these as variables - * with absolute locations: - * uint8_t xdata MDMCTRL0H_VAR at addr; + * 1. Define typedef'ed data types and type cast addresses using this + * datatype. Later this is mangled to the correct syntax. The + * drawback is that it seems that sometimes CIL (the inliner) seems + * to be too clever and replace the typedef'ed type with the original. + * *(uint8_t_xdata* 0x??) = xx * - * However mangling this in a compiler agnostic way is probaby more - * difficult than stickting to something that looks like ANSI-C + * 2. Use the attribute syntax all the way and create an expression + * similar to GCC. This unfortunate seems to clash with the + * typeforwading from CIL making it produce an extra type forward + * that fails in Keil on certain occations (e.g. if an extra (int) is + * inserted this becomes (int xdata) which Keil does not accept). + * *(uint8_t __attribute((xdata)) *) 0x?? = xx * + * 3. As above define a list of global variables these as variables + * with absolute locations: + * uint8_t xdata MDMCTRL0H_VAR at addr; * + * Note: these variables should probably be marked volatile, but + * unfortunately this seems to clash with CIL in the same way as 2) + * (i.e. (int) becomes (int volatile) which is not accepted by Keil) + * + * */ +/* Alternative 1 */ typedef uint16_t uint16_t_xdata; // will be replaced by uint16_t xdata typedef uint8_t uint8_t_xdata; // will be replaced by uint8_t xdata typedef uint16_t uint16_t_code; // will be replaced by uint16_t code typedef uint8_t uint8_t_code; // will be replaced by uint8_t code - -// I would say these should be volatile, but nesc throws up -//#define _XIO16(addr) (*((volatile unint16_t_xdata*) addr)) -//#define _XIO8(addr) (*((uint8_t volatile_xdata*) addr)) - #define _XIO16(addr) (*(( uint16_t_xdata*) addr)) #define _XIO8(addr) (*(( uint8_t_xdata*) addr)) -#define _CC2430_MDMCTRL0 _XIO16(0xDF02 ) /* Modem Control 0 */ -#define _CC2430_MDMCTRL0H _XIO8( 0xDF02 ) /* Modem Control 0 High Byte */ -#define _CC2430_MDMCTRL0L _XIO8( 0xDF03 ) /* Modem Control 0 Low Byte */ -#define _CC2430_MDMCTRL1 _XIO16(0xDF04 ) /* Modem Control 1 */ -#define _CC2430_MDMCTRL1H _XIO8( 0xDF04 ) /* Modem Control 1 High Byte */ -#define _CC2430_MDMCTRL1L _XIO8( 0xDF05 ) /* Modem Control 1 Low Byte */ -#define _CC2430_RSSIH _XIO8( 0xDF06 ) /* RSSI and CCA Status and Control High Byte */ -#define _CC2430_RSSIL _XIO8( 0xDF07 ) /* RSSI and CCA Status and Control Low Byte */ -#define _CC2430_SYNCWORD _XIO16(0xDF08 ) /* Synchronization and Control */ -#define _CC2430_SYNCWORDH _XIO8( 0xDF08 ) /* Synchronization and Control High Byte */ -#define _CC2430_SYNCWORDL _XIO8( 0xDF09 ) /* Synchronization and Control Low Byte */ -#define _CC2430_TXCTRL _XIO16(0xDF0A ) /* Transmit Control */ -#define _CC2430_TXCTRLH _XIO8( 0xDF0A ) /* Transmit Control High Byte */ -#define _CC2430_TXCTRLL _XIO8( 0xDF0B ) /* Transmit Control Low Byte */ -#define _CC2430_RXCTRL0 _XIO16(0xDF0C ) /* Receive Control 0 */ -#define _CC2430_RXCTRL0H _XIO8( 0xDF0C ) /* Receive Control 0 High Byte */ -#define _CC2430_RXCTRL0L _XIO8( 0xDF0D ) /* Receive Control 0 Low Byte */ -#define _CC2430_RXCTRL1 _XIO8( 0xDF0E ) /* Receive Control 1 */ -#define _CC2430_RXCTRL1H _XIO8( 0xDF0E ) /* Receive Control 1 High Byte */ -#define _CC2430_RXCTRL1L _XIO8( 0xDF0F ) /* Receive Control 1 Low Byte */ -#define _CC2430_FSCTRL _XIO16(0xDF10 ) /* Frequency Synthesizer Control and Status */ -#define _CC2430_FSCTRLH _XIO8( 0xDF10 ) /* Frequency Synthesizer Control and Status High Byte*/ -#define _CC2430_FSCTRLL _XIO8( 0xDF11 ) /* Frequency Synthesizer Control and Status Low Byte */ -#define _CC2430_CSPX _XIO8( 0xDF12 ) /* CSMA/CA Strobe Processor X Data Register */ -#define _CC2430_CSPY _XIO8( 0xDF13 ) /* CSMA/CA Strobe Processor Y Data Register */ -#define _CC2430_CSPZ _XIO8( 0xDF14 ) /* CSMA/CA Strobe Processor Z Data Register */ -#define _CC2430_CSPCTRL _XIO8( 0xDF15 ) /* CSMA/CA Strobe Processor CPU Control Input */ -#define _CC2430_CSPT _XIO8( 0xDF16 ) /* CSMA/CA Strobe Processor T Data Register */ -#define _CC2430_RFPWR _XIO8( 0xDF17 ) /* Radio Power */ -#define _CC2430_FSMTCH _XIO8( 0xDF20 ) /* Finite State Machine Time Constants High Byte */ -#define _CC2430_FSMTCL _XIO8( 0xDF21 ) /* Finite State Machine Time Constants Low Byte */ -#define _CC2430_MANANDH _XIO8( 0xDF22 ) /* Manual Signal AND Override High Byte */ -#define _CC2430_MANANDL _XIO8( 0xDF23 ) /* Manual Signal AND Override Low Byte */ -#define _CC2430_MANORH _XIO8( 0xDF24 ) /* Manual Signal OR Override High Byte */ -#define _CC2430_MANORL _XIO8( 0xDF25 ) /* Manual Signal OR Override High Byte */ -#define _CC2430_AGCCTRLH _XIO8( 0xDF26 ) /* AGC Control High Byte */ -#define _CC2430_AGCCTRLL _XIO8( 0xDF27 ) /* AGC Control Low Byte */ -#define _CC2430_FSMSTATE _XIO8( 0xDF39 ) /* Finite State Machine State */ -#define _CC2430_ADCTSTH _XIO8( 0xDF3A ) /* ADC Test High Byte */ -#define _CC2430_ADCTSTL _XIO8( 0xDF3B ) /* ADC Test Low Byte */ -#define _CC2430_DACTSTH _XIO8( 0xDF3C ) /* DAC Test High Byte */ -#define _CC2430_DACTSTL _XIO8( 0xDF3D ) /* DAC Test Low Byte */ -#define _CC2430_IEEE_ADDR0 _XIO8( 0xDF43 ) /* IEEE Address Byte 0 (LSB) */ -#define _CC2430_IEEE_ADDR1 _XIO8( 0xDF44 ) /* IEEE Address Byte 1 */ -#define _CC2430_IEEE_ADDR2 _XIO8( 0xDF45 ) /* IEEE Address Byte 2 */ -#define _CC2430_IEEE_ADDR3 _XIO8( 0xDF46 ) /* IEEE Address Byte 3 */ -#define _CC2430_IEEE_ADDR4 _XIO8( 0xDF47 ) /* IEEE Address Byte 4 */ -#define _CC2430_IEEE_ADDR5 _XIO8( 0xDF48 ) /* IEEE Address Byte 5 */ -#define _CC2430_IEEE_ADDR6 _XIO8( 0xDF49 ) /* IEEE Address Byte 6 */ -#define _CC2430_IEEE_ADDR7 _XIO8( 0xDF4A ) /* IEEE Address Byte 7 (MSB) */ +/* Alternative 2 */ -#define _CC2430_PANID _XIO16(0xDF4B ) /* PAN Identifier */ -#define _CC2430_PANIDH _XIO8( 0xDF4B ) /* PAN Identifier High Byte */ -#define _CC2430_PANIDL _XIO8( 0xDF4C ) /* PAN Identifier Low Byte */ +/* #define _XIO16(addr) (*(( uint16_t __attribute((xdata))*) addr)) */ +/* #define _XIO8(addr) (*(( uint8_t __attribute((xdata))*) addr)) */ -#define _CC2430_SHORTADDR _XIO16(0xDF4D ) /* Short Address */ -#define _CC2430_SHORTADDRH _XIO8( 0xDF4D ) /* Short Address High Byte */ -#define _CC2430_SHORTADDRL _XIO8( 0xDF4E ) /* Short Address Low Byte */ -#define _CC2430_IOCFG01 _XIO16(0xDF4F ) /* Input/Output Control 0+1 */ -#define _CC2430_IOCFG0 _XIO8( 0xDF4F ) /* Input/Output Control 0 */ -#define _CC2430_IOCFG1 _XIO8( 0xDF50 ) /* Input/Output Control 1 */ -#define _CC2430_IOCFG23 _XIO16(0xDF51 ) /* Input/Output Control 2+3 */ -#define _CC2430_IOCFG2 _XIO8( 0xDF51 ) /* Input/Output Control 2 */ -#define _CC2430_IOCFG3 _XIO8( 0xDF52 ) /* Input/Output Control 3 */ -#define _CC2430_RXFIFOCNT _XIO8( 0xDF53 ) /* Receive FIFO Count */ -#define _CC2430_FSMTC1 _XIO8( 0xDF54 ) /* Finite State Machine Time Constants */ -#define _CC2430_CHVER _XIO8( 0xDF60 ) /* Chip Revision Number */ -#define _CC2430_CHIPID _XIO8( 0xDF61 ) /* Chip ID Number */ -#define _CC2430_RFSTATUS _XIO8( 0xDF62 ) /* Radio Status */ +#define _CC2430_MDMCTRL0 _XIO16(0xDF02u ) /* Modem Control 0 */ +#define _CC2430_MDMCTRL0H _XIO8( 0xDF02u ) /* Modem Control 0 High Byte */ +#define _CC2430_MDMCTRL0L _XIO8( 0xDF03u ) /* Modem Control 0 Low Byte */ +#define _CC2430_MDMCTRL1 _XIO16(0xDF04u ) /* Modem Control 1 */ +#define _CC2430_MDMCTRL1H _XIO8( 0xDF04u ) /* Modem Control 1 High Byte */ +#define _CC2430_MDMCTRL1L _XIO8( 0xDF05u ) /* Modem Control 1 Low Byte */ +#define _CC2430_RSSIH _XIO8( 0xDF06u ) /* RSSI and CCA Status and Control High Byte */ +#define _CC2430_RSSIL _XIO8( 0xDF07u ) /* RSSI and CCA Status and Control Low Byte */ +#define _CC2430_SYNCWORD _XIO16(0xDF08u ) /* Synchronization and Control */ +#define _CC2430_SYNCWORDH _XIO8( 0xDF08u ) /* Synchronization and Control High Byte */ +#define _CC2430_SYNCWORDL _XIO8( 0xDF09u ) /* Synchronization and Control Low Byte */ +#define _CC2430_TXCTRL _XIO16(0xDF0Au ) /* Transmit Control */ +#define _CC2430_TXCTRLH _XIO8( 0xDF0Au ) /* Transmit Control High Byte */ +#define _CC2430_TXCTRLL _XIO8( 0xDF0Bu ) /* Transmit Control Low Byte */ +#define _CC2430_RXCTRL0 _XIO16(0xDF0Cu ) /* Receive Control 0 */ +#define _CC2430_RXCTRL0H _XIO8( 0xDF0Cu ) /* Receive Control 0 High Byte */ +#define _CC2430_RXCTRL0L _XIO8( 0xDF0Du ) /* Receive Control 0 Low Byte */ +#define _CC2430_RXCTRL1 _XIO8( 0xDF0Eu ) /* Receive Control 1 */ +#define _CC2430_RXCTRL1H _XIO8( 0xDF0Eu ) /* Receive Control 1 High Byte */ +#define _CC2430_RXCTRL1L _XIO8( 0xDF0Fu ) /* Receive Control 1 Low Byte */ +#define _CC2430_FSCTRL _XIO16(0xDF10u ) /* Frequency Synthesizer Control and Status */ +#define _CC2430_FSCTRLH _XIO8( 0xDF10u ) /* Frequency Synthesizer Control and Status High Byte*/ +#define _CC2430_FSCTRLL _XIO8( 0xDF11u ) /* Frequency Synthesizer Control and Status Low Byte */ +#define _CC2430_CSPX _XIO8( 0xDF12u ) /* CSMA/CA Strobe Processor X Data Register */ +#define _CC2430_CSPY _XIO8( 0xDF13u ) /* CSMA/CA Strobe Processor Y Data Register */ +#define _CC2430_CSPZ _XIO8( 0xDF14u ) /* CSMA/CA Strobe Processor Z Data Register */ +#define _CC2430_CSPCTRL _XIO8( 0xDF15u ) /* CSMA/CA Strobe Processor CPU Control Input */ +#define _CC2430_CSPT _XIO8( 0xDF16u ) /* CSMA/CA Strobe Processor T Data Register */ +#define _CC2430_RFPWR _XIO8( 0xDF17u ) /* Radio Power */ +#define _CC2430_FSMTCH _XIO8( 0xDF20u ) /* Finite State Machine Time Constants High Byte */ +#define _CC2430_FSMTCL _XIO8( 0xDF21u ) /* Finite State Machine Time Constants Low Byte */ +#define _CC2430_MANANDH _XIO8( 0xDF22u ) /* Manual Signal AND Override High Byte */ +#define _CC2430_MANANDL _XIO8( 0xDF23u ) /* Manual Signal AND Override Low Byte */ +#define _CC2430_MANORH _XIO8( 0xDF24u ) /* Manual Signal OR Override High Byte */ +#define _CC2430_MANORL _XIO8( 0xDF25u ) /* Manual Signal OR Override High Byte */ +#define _CC2430_AGCCTRLH _XIO8( 0xDF26u ) /* AGC Control High Byte */ +#define _CC2430_AGCCTRLL _XIO8( 0xDF27u ) /* AGC Control Low Byte */ +#define _CC2430_FSMSTATE _XIO8( 0xDF39u ) /* Finite State Machine State */ +#define _CC2430_ADCTSTH _XIO8( 0xDF3Au ) /* ADC Test High Byte */ +#define _CC2430_ADCTSTL _XIO8( 0xDF3Bu ) /* ADC Test Low Byte */ +#define _CC2430_DACTSTH _XIO8( 0xDF3Cu ) /* DAC Test High Byte */ +#define _CC2430_DACTSTL _XIO8( 0xDF3Du ) /* DAC Test Low Byte */ +#define _CC2430_IEEE_ADDR0 _XIO8( 0xDF43u ) /* IEEE Address Byte 0 (LSB) */ +#define _CC2430_IEEE_ADDR1 _XIO8( 0xDF44u ) /* IEEE Address Byte 1 */ +#define _CC2430_IEEE_ADDR2 _XIO8( 0xDF45u ) /* IEEE Address Byte 2 */ +#define _CC2430_IEEE_ADDR3 _XIO8( 0xDF46u ) /* IEEE Address Byte 3 */ +#define _CC2430_IEEE_ADDR4 _XIO8( 0xDF47u ) /* IEEE Address Byte 4 */ +#define _CC2430_IEEE_ADDR5 _XIO8( 0xDF48u ) /* IEEE Address Byte 5 */ +#define _CC2430_IEEE_ADDR6 _XIO8( 0xDF49u ) /* IEEE Address Byte 6 */ +#define _CC2430_IEEE_ADDR7 _XIO8( 0xDF4Au ) /* IEEE Address Byte 7 (MSB) */ +#define _CC2430_PANID _XIO16(0xDF4Bu ) /* PAN Identifier */ +#define _CC2430_PANIDH _XIO8( 0xDF4Bu ) /* PAN Identifier High Byte */ +#define _CC2430_PANIDL _XIO8( 0xDF4Cu ) /* PAN Identifier Low Byte */ + +#define _CC2430_SHORTADDR _XIO16(0xDF4Du ) /* Short Address */ +#define _CC2430_SHORTADDRH _XIO8( 0xDF4Du ) /* Short Address High Byte */ +#define _CC2430_SHORTADDRL _XIO8( 0xDF4Eu ) /* Short Address Low Byte */ +#define _CC2430_IOCFG01 _XIO16(0xDF4Fu ) /* Input/Output Control 0+1 */ +#define _CC2430_IOCFG0 _XIO8( 0xDF4Fu ) /* Input/Output Control 0 */ +#define _CC2430_IOCFG1 _XIO8( 0xDF50u ) /* Input/Output Control 1 */ +#define _CC2430_IOCFG23 _XIO16(0xDF51u ) /* Input/Output Control 2+3 */ +#define _CC2430_IOCFG2 _XIO8( 0xDF51u ) /* Input/Output Control 2 */ +#define _CC2430_IOCFG3 _XIO8( 0xDF52u ) /* Input/Output Control 3 */ +#define _CC2430_RXFIFOCNT _XIO8( 0xDF53u ) /* Receive FIFO Count */ +#define _CC2430_FSMTC1 _XIO8( 0xDF54u ) /* Finite State Machine Time Constants */ +#define _CC2430_CHVER _XIO8( 0xDF60u ) /* Chip Revision Number */ +#define _CC2430_CHIPID _XIO8( 0xDF61u ) /* Chip ID Number */ +#define _CC2430_RFSTATUS _XIO8( 0xDF62u ) /* Radio Status */ + /* Bit fields for xdata registers */ enum { Modified: trunk/diku/mcs51/tos/chips/cc2430/radio/HalCC2430RadioP.nc =================================================================== --- trunk/diku/mcs51/tos/chips/cc2430/radio/HalCC2430RadioP.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/tos/chips/cc2430/radio/HalCC2430RadioP.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -87,7 +87,7 @@ *** StdControl **************************************************************************************************/ // uint16_t mcr0 = 0x0AE2, iocfg0 = 0x007F; - uint16_t mcr0 = 0x0000, iocfg0 = 0x007F; + uint16_t mcr0 = 0x0000u, iocfg0 = 0x007Fu; MDMCTRL0_t * mcr0Ptr; ieee_mac_addr_t ieeeAddress; Modified: trunk/diku/mcs51/tos/chips/cc2430/radio/HplCC2430RadioC.nc =================================================================== --- trunk/diku/mcs51/tos/chips/cc2430/radio/HplCC2430RadioC.nc 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/tos/chips/cc2430/radio/HplCC2430RadioC.nc 2009-10-05 19:47:07 UTC (rev 1095) @@ -209,12 +209,12 @@ // The generic-module system does not allow pointers, so we cast a bit async command cc2420_status_t Reg.read[ uint16_t addr ]( uint16_t* data ) { - *data = *((uint16_t_xdata*) addr); + *data = *((uint16_t __attribute((xdata))*) addr); return SUCCESS; } async command cc2420_status_t Reg.write[ uint16_t addr ]( uint16_t data ) { - *((uint16_t_xdata*) addr) = data; + *((uint16_t __attribute((xdata))*) addr) = data; return SUCCESS; } Modified: trunk/diku/mcs51/tos/chips/mcs51/io8051.h =================================================================== --- trunk/diku/mcs51/tos/chips/mcs51/io8051.h 2009-09-27 19:51:12 UTC (rev 1094) +++ trunk/diku/mcs51/tos/chips/mcs51/io8051.h 2009-10-05 19:47:07 UTC (rev 1095) @@ -32,31 +32,41 @@ /** * * This file defines properties shared among 8051 variants. Chip - * specific additions are found in the directories for those chips + * specific additions are found in the directories for those chips. * * The special function register definitions are created in a slightly * odd way in order to allow special attributes to pass through nescc - * unchanged and then be modified by a mangle script later. + * unchanged and then be modified by a mangle script later. For Keil + * the sfr/sbit definitions cannot be created inside a function body - + * they have to be made outside (see "Cx51 User" under sfr/bit types) + * so we create a list of global variables and mark them with the NesC + * keyword norace. This is no less safe than the GCC approach, that + * addresses registers as an on the fly pointer access (e.g. *(int* + * 0x?) = ?). * - * For Keil the sfr/sbit definitions cannot be created inside a - * function body - they have to be made outside (see "Cx51 User" under - * sfr/bit types). - * * The __attribute(()) will be removed by the mangle script and * the content x will be used to construct: * sfr at x ... * - * Alternative to stay within ANSI-C one could imagine using a - * structure with bit fields say struct { int P0:1 }, however the - * silly architecture of the 8051 forces us to controll whether code - * using direct or indirect addressing is generated. I can't se how - * this could be done using ANSI-C. + * An alternative to this approach would be to try and mimick the way + * GCC defines register values, by defineing a macro that expands to + * the appropriate memory type specifier. However that is not + * supported by Keil for sfr and sbit data type + * REGX = xx => * (* uint8_t xdata) <REGX_ADDR> = xx + * REGY = xx => * (* sfr ) <REGX_ADDR> = xx (not supported) * + * To stay within ANSI-C one could imagine using a structure with bit + * fields say struct { int P0:1 }, however the silly architecture of + * the 8051 forces us to controll whether code using direct or + * indirect addressing is generated. I can't se how this could be done + * using ANSI-C. + * * The above scheme allows nescc to parse the code and sdcc to to * generate the appropriate code. * - * Interrupt definitions are moved to the include file for each architectore as - * no lowest commen denominator could be found. See mcs51hardware.h for more. + * Interrupt definitions are moved to the include file for each + * architectore as no lowest commen denominator could be found. See + * mcs51hardware.h for more. * * @author Martin Leopold <le...@di...> * @author Sidsel Jensen @@ -78,84 +88,84 @@ MCS51_PCON_IDLE = 0 }; -uint8_t volatile P0 __attribute((sfrAT0x80)); -uint8_t volatile SP __attribute((sfrAT0x81)); -uint8_t volatile DPL __attribute((sfrAT0x82)); -uint8_t volatile DPH __attribute((sfrAT0x83)); -uint8_t volatile DPL1 __attribute((sfrAT0x84)); -uint8_t volatile DPH1 __attribute((sfrAT0x85)); +norace uint8_t volatile P0 __attribute((sfrAT0x80)); +norace uint8_t volatile SP __attribute((sfrAT0x81)); +norace uint8_t volatile DPL __attribute((sfrAT0x82)); +norace uint8_t volatile DPH __attribute((sfrAT0x83)); +norace uint8_t volatile DPL1 __attribute((sfrAT0x84)); +norace uint8_t volatile DPH1 __attribute((sfrAT0x85)); // 0x86 used differently by CC2430/nRF24E1 -uint8_t volatile PCON __attribute((sfrAT0x87)); -uint8_t volatile TCON __attribute((sfrAT0x88)); -uint8_t volatile TMOD __attribute((sfrAT0x89)); -uint8_t volatile TL0 __attribute((sfrAT0x8A)); -uint8_t volatile TL1 __attribute((sfrAT0x8B)); -uint8_t volatile TH0 __attribute((sfrAT0x8C)); -uint8_t volatile TH1 __attribute((sfrAT0x8D)); -uint8_t volatile CKCON __attribute((sfrAT0x8E)); -uint8_t volatile P1 __attribute((sfrAT0x90)); -uint8_t volatile EXIF __attribute((sfrAT0x91)); -uint8_t volatile MPAGE __attribute((sfrAT0x92)); -uint8_t volatile SCON __attribute((sfrAT0x98)); -uint8_t volatile SBUF __attribute((sfrAT0x99)); -uint8_t volatile T2CON __attribute((sfrAT0xC8)); -uint8_t volatile RCAP2L __attribute((sfrAT0xCA)); -uint8_t volatile RCAP2H __attribute((sfrAT0xCB)); -uint8_t volatile TL2 __attribute((sfrAT0xCC)); -uint8_t volatile TH2 __attribute((sfrAT0xCD)); -uint8_t volatile PSW __attribute((sfrAT0xD0)); -uint8_t volatile EICON __attribute((sfrAT0xD8)); -uint8_t volatile ACC __attribute((sfrAT0xE0)); -uint8_t volatile B __attribute((sfrAT0xF0)); +norace uint8_t volatile PCON __attribute((sfrAT0x87)); +norace uint8_t volatile TCON __attribute((sfrAT0x88)); +norace uint8_t volatile TMOD __attribute((sfrAT0x89)); +norace uint8_t volatile TL0 __attribute((sfrAT0x8A)); +norace uint8_t volatile TL1 __attribute((sfrAT0x8B)); +norace uint8_t volatile TH0 __attribute((sfrAT0x8C)); +norace uint8_t volatile TH1 __attribute((sfrAT0x8D)); +norace uint8_t volatile CKCON __attribute((sfrAT0x8E)); +norace uint8_t volatile P1 __attribute((sfrAT0x90)); +norace uint8_t volatile EXIF __attribute((sfrAT0x91)); +norace uint8_t volatile MPAGE __attribute((sfrAT0x92)); +norace uint8_t volatile SCON __attribute((sfrAT0x98)); +norace uint8_t volatile SBUF __attribute((sfrAT0x99)); +norace uint8_t volatile T2CON __attribute((sfrAT0xC8)); +norace uint8_t volatile RCAP2L __attribute((sfrAT0xCA)); +norace uint8_t volatile RCAP2H __attribute((sfrAT0xCB)); +norace uint8_t volatile TL2 __attribute((sfrAT0xCC)); +norace uint8_t volatile TH2 __attribute((sfrAT0xCD)); +norace uint8_t volatile PSW __attribute((sfrAT0xD0)); +norace uint8_t volatile EICON __attribute((sfrAT0xD8)); +norace uint8_t volatile ACC __attribute((sfrAT0xE0)); +norace uint8_t volatile B __attribute((sfrAT0xF0)); // Interrupt control at 0xE8 is used differently -uint8_t volatile EIP __attribute((sfrAT0xF8)); -uint8_t volatile P1_ALT __attribute((sfrAT0x97)); -uint8_t volatile P2 __attribute((sfrAT0xA0)); -uint8_t volatile ADCCON __attribute((sfrAT0xA1)); -uint8_t volatile ADCDATAH __attribute((sfrAT0xA2)); -uint8_t volatile ADCDATAL __attribute((sfrAT0xA3)); -uint8_t volatile ADCSTATIC __attribute((sfrAT0xA4)); -uint8_t volatile PWMCON __attribute((sfrAT0xA9)); -uint8_t volatile PWMDUTY __attribute((sfrAT0xAA)); -uint8_t volatile REGX_MSB __attribute((sfrAT0xAB)); -uint8_t volatile REGX_LSB __attribute((sfrAT0xAC)); -uint8_t volatile REGX_CTRL __attribute((sfrAT0xAD)); -uint8_t volatile RSTREAS __attribute((sfrAT0xB1)); -uint8_t volatile SPI_DATA __attribute((sfrAT0xB2)); -uint8_t volatile SPI_CTRL __attribute((sfrAT0xB3)); -uint8_t volatile SPICLK __attribute((sfrAT0xB4)); -uint8_t volatile TICK_DV __attribute((sfrAT0xB5)); -uint8_t volatile CK_CTRL __attribute((sfrAT0xB6)); +norace uint8_t volatile EIP __attribute((sfrAT0xF8)); +norace uint8_t volatile P1_ALT __attribute((sfrAT0x97)); +norace uint8_t volatile P2 __attribute((sfrAT0xA0)); +norace uint8_t volatile ADCCON __attribute((sfrAT0xA1)); +norace uint8_t volatile ADCDATAH __attribute((sfrAT0xA2)); +norace uint8_t volatile ADCDATAL __attribute((sfrAT0xA3)); +norace uint8_t volatile ADCSTATIC __attribute((sfrAT0xA4)); +norace uint8_t volatile PWMCON __attribute((sfrAT0xA9)); +norace uint8_t volatile PWMDUTY __attribute((sfrAT0xAA)); +norace uint8_t volatile REGX_MSB __attribute((sfrAT0xAB)); +norace uint8_t volatile REGX_LSB __attribute((sfrAT0xAC)); +norace uint8_t volatile REGX_CTRL __attribute((sfrAT0xAD)); +norace uint8_t volatile RSTREAS __attribute((sfrAT0xB1)); +norace uint8_t volatile SPI_DATA __attribute((sfrAT0xB2)); +norace uint8_t volatile SPI_CTRL __attribute((sfrAT0xB3)); +norace uint8_t volatile SPICLK __attribute((sfrAT0xB4)); +norace uint8_t volatile TICK_DV __attribute((sfrAT0xB5)); +norace uint8_t volatile CK_CTRL __attribute((sfrAT0xB6)); /* BIT Registers */ /* PSW */ -uint8_t volatile CY __attribute((sbitAT0xD7)); -uint8_t volatile AC __attribute((sbitAT0xD6)); -uint8_t volatile F0 __attribute((sbitAT0xD5)); -uint8_t volatile RS1 __attribute((sbitAT0xD4)); -uint8_t volatile RS0 __attribute((sbitAT0xD3)); -uint8_t volatile OV __attribute((sbitAT0xD2)); -uint8_t volatile F1 __attribute((sbitAT0xD1)); -uint8_t volatile P __attribute((sbitAT0xD0)); +norace uint8_t volatile CY __attribute((sbitAT0xD7)); +norace uint8_t volatile AC __attribute((sbitAT0xD6)); +norace uint8_t volatile F0 __attribute((sbitAT0xD5)); +norace uint8_t volatile RS1 __attribute((sbitAT0xD4)); +norace uint8_t volatile RS0 __attribute((sbitAT0xD3)); +norace uint8_t volatile OV __attribute((sbitAT0xD2)); +norace uint8_t volatile F1 __attribute((sbitAT0xD1)); +norace uint8_t volatile P __attribute((sbitAT0xD0)); /* TCON */ -uint8_t volatile TF1 __attribute((sbitAT0x8F)); -uint8_t volatile TR1 __attribute((sbitAT0x8E)); -uint8_t volatile TF0 __attribute((sbitAT0x8D)); -uint8_t volatile TR0 __attribute((sbitAT0x8C)); -uint8_t volatile IE1 __attribute((sbitAT0x8B)); -uint8_t volatile IT1 __attribute((sbitAT0x8A)); -uint8_t volatile IE0 __attribute((sbitAT0x89)); -uint8_t volatile IT0 __attribute((sbitAT0x88)); +norace uint8_t volatile TF1 __attribute((sbitAT0x8F)); +norace uint8_t volatile TR1 __attribute((sbitAT0x8E)); +norace uint8_t volatile TF0 __attribute((sbitAT0x8D)); +norace uint8_t volatile TR0 __attribute((sbitAT0x8C)); +norace uint8_t volatile IE1 __attribute((sbitAT0x8B)); +norace uint8_t volatile IT1 __attribute((sbitAT0x8A)); +norace uint8_t volatile IE0 __attribute((sbitAT0x89)); +norace uint8_t volatile IT0 __attribute((sbitAT0x88)); /* IE */ @@ -165,126 +175,126 @@ to vary. On chipcon this register is name IE0EN */ -uint8_t volatile IE __attribute((sfrAT0A8)); -norace uint8_t volatile EA __attribute((sbitAT0xAF)); +norace uint8_t volatile IE __attribute((sfrAT0A8)); +norace norace uint8_t volatile EA __attribute((sbitAT0xAF)); /* IP */ -uint8_t volatile PT2 __attribute((sbitAT0xBD)); -uint8_t volatile PS __attribute((sbitAT0xBC)); -uint8_t volatile PT1 __attribute((sbitAT0xBB)); -uint8_t volatile PX1 __attribute((sbitAT0xBA)); -uint8_t volatile PT0 __attribute((sbitAT0xB9)); -uint8_t volatile PX0 __attribute((sbitAT0xB8)); +norace uint8_t volatile PT2 __attribute((sbitAT0xBD)); +norace uint8_t volatile PS __attribute((sbitAT0xBC)); +norace uint8_t volatile PT1 __attribute((sbitAT0xBB)); +norace uint8_t volatile PX1 __attribute((sbitAT0xBA)); +norace uint8_t volatile PT0 __attribute((sbitAT0xB9)); +norace uint8_t volatile PX0 __attribute((sbitAT0xB8)); /* P0 bit adressable locations */ -uint8_t volatile P0_0 __attribute((sbitAT0x80)); -uint8_t volatile P0_1 __attribute((sbitAT0x81)); -uint8_t volatile P0_2 __attribute((sbitAT0x82)); -uint8_t volatile P0_3 __attribute((sbitAT0x83)); -uint8_t volatile P0_4 __attribute((sbitAT0x84)); -uint8_t volatile P0_5 __attribute((sbitAT0x85)); -uint8_t volatile P0_6 __attribute((sbitAT0x86)); -uint8_t volatile P0_7 __attribute((sbitAT0x87)); +norace uint8_t volatile P0_0 __attribute((sbitAT0x80)); +norace uint8_t volatile P0_1 __attribute((sbitAT0x81)); +norace uint8_t volatile P0_2 __attribute((sbitAT0x82)); +norace uint8_t volatile P0_3 __attribute((sbitAT0x83)); +norace uint8_t volatile P0_4 __attribute((sbitAT0x84)); +norace uint8_t volatile P0_5 __attribute((sbitAT0x85)); +norace uint8_t volatile P0_6 __attribute((sbitAT0x86)); +norace uint8_t volatile P0_7 __attribute((sbitAT0x87)); /* P0 alternate functions */ -uint8_t volatile T1 __attribute((sbitAT0x86)); -uint8_t volatile T0 __attribute((sbitAT0x85)); -uint8_t volatile INT1 __attribute((sbitAT0x84)); -uint8_t volatile INT0 __attribute((sbitAT0x83)); +norace uint8_t volatile T1 __attribute((sbitAT0x86)); +norace uint8_t volatile T0 __attribute((sbitAT0x85)); +norace uint8_t volatile INT1 __attribute((sbitAT0x84)); +norace uint8_t volatile INT0 __attribute((sbitAT0x83)); /* P1 bit adressable locations */ -uint8_t volatile P1_0 __attribute((sbitAT0x90)); -uint8_t volatile P1_1 __attribute((sbitAT0x91)); -uint8_t volatile P1_2 __attribute((sbitAT0x92)); -uint8_t volatile P1_3 __attribute((sbitAT0x93)); -uint8_t volatile P1_4 __attribute((sbitAT0x94)); -uint8_t volatile P1_5 __attribute((sbitAT0x95)); -uint8_t volatile P1_6 __attribute((sbitAT0x96)); -uint8_t volatile P1_7 __attribute((sbitAT0x97)); +norace uint8_t volatile P1_0 __attribute((sbitAT0x90)); +norace uint8_t volatile P1_1 __attribute((sbitAT0x91)); +norace uint8_t volatile P1_2 __attribute((sbitAT0x92)); +norace uint8_t volatile P1_3 __attribute((sbitAT0x93)); +norace uint8_t volatile P1_4 __attribute((sbitAT0x94)); +norace uint8_t volatile P1_5 __attribute((sbitAT0x95)); +norace uint8_t volatile P1_6 __attribute((sbitAT0x96)); +norace uint8_t volatile P1_7 __attribute((sbitAT0x97)); /* P1 alternate functions*/ -uint8_t volatile T2 __attribute((sbitAT0x90)); +norace uint8_t volatile T2 __attribute((sbitAT0x90)); /* P2 bit adressable locations */ /* On some platforms (eg. cc2430) not all are available */ -uint8_t volatile P2_0 __attribute((sbitAT0xA0)); -uint8_t volatile P2_1 __attribute((sbitAT0xA1)); -uint8_t volatile P2_2 __attribute((sbitAT0xA2)); -uint8_t volatile P2_3 __attribute((sbitAT0xA3)); -uint8_t volatile P2_4 __attribute((sbitAT0xA4)); -uint8_t volatile P2_5 __attribute((sbitAT0xA5)); -uint8_t volatile P2_6 __attribute((sbitAT0xA6)); -uint8_t volatile P2_7 __attribute((sbitAT0xA7)); +norace uint8_t volatile P2_0 __attribute((sbitAT0xA0)); +norace uint8_t volatile P2_1 __attribute((sbitAT0xA1)); +norace uint8_t volatile P2_2 __attribute((sbitAT0xA2)); +norace uint8_t volatile P2_3 __attribute((sbitAT0xA3)); +norace uint8_t volatile P2_4 __attribute((sbitAT0xA4)); +norace uint8_t volatile P2_5 __attribute((sbitAT0xA5)); +norace uint8_t volatile P2_6 __attribute((sbitAT0xA6)); +norace uint8_t volatile P2_7 __attribute((sbitAT0xA7)); /* SCON */ -uint8_t volatile SM0 __attribute((sbitAT0x9F)); -uint8_t volatile SM1 __attribute((sbitAT0x9E)); -uint8_t volatile SM2 __attribute((sbitAT0x9D)); -uint8_t volatile REN __attribute((sbitAT0x9C)); -uint8_t volatile TB8 __attribute((sbitAT0x9B)); -uint8_t volatile RB8 __attribute((sbitAT0x9A)); -uint8_t volatile TI __attribute((sbitAT0x99)); -uint8_t volatile RI __attribute((sbitAT0x98)); +norace uint8_t volatile SM0 __attribute((sbitAT0x9F)); +norace uint8_t volatile SM1 __attribute((sbitAT0x9E)); +norace uint8_t volatile SM2 __attribute((sbitAT0x9D)); +norace uint8_t volatile REN __attribute((sbitAT0x9C)); +norace uint8_t volatile TB8 __attribute((sbitAT0x9B)); +norace uint8_t volatile RB8 __attribute((sbitAT0x9A)); +norace uint8_t volatile TI __attribute((sbitAT0x99)); +norace uint8_t volatile RI __attribute((sbitAT0x98)); /* T2CON */ -uint8_t volatile TF2 __attribute((sbitAT0xCF)); -uint8_t volatile EXF2 __attribute((sbitAT0xCE)); -uint8_t volatile RCLK __attribute((sbitAT0xCD)); -uint8_t volatile TCLK __attribute((sbitAT0xCC)); -uint8_t volatile EXEN2 __attribute((sbitAT0xCB)); -uint8_t volatile TR2 __attribute((sbitAT0xCA)); -uint8_t volatile C_T2 __attribute((sbitAT0xC9)); -uint8_t volatile CP_RL2 __attribute((sbitAT0xC8)); +norace uint8_t volatile TF2 __attribute((sbitAT0xCF)); +norace uint8_t volatile EXF2 __attribute((sbitAT0xCE)); +norace uint8_t volatile RCLK __attribute((sbitAT0xCD)); +norace uint8_t volatile TCLK __attribute((sbitAT0xCC)); +norace uint8_t volatile EXEN2 __attribute((sbitAT0xCB)); +norace uint8_t volatile TR2 __attribute((sbitAT0xCA)); +norace uint8_t volatile C_T2 __attribute((sbitAT0xC9)); +norace uint8_t volatile CP_RL2 __attribute((sbitAT0xC8)); /* EICON */ -uint8_t volatile SMOD1 __attribute((sbitAT0xDF)); -uint8_t volatile WDTI __attribute((sbitAT0xDB)); +norace uint8_t volatile SMOD1 __attribute((sbitAT0xDF)); +norace uint8_t volatile WDTI __attribute((sbitAT0xDB)); /* EIE */ -uint8_t volatile EWDI __attribute((sbitAT0xEC)); -uint8_t volatile EX5 __attribute((sbitAT0xEB)); -uint8_t volatile EX4 __attribute((sbitAT0xEA)); -uint8_t volatile EX3 __attribute((sbitAT0xE9)); -uint8_t volatile EX2 __attribute((sbitAT0xE8)); +norace uint8_t volatile EWDI __attribute((sbitAT0xEC)); +norace uint8_t volatile EX5 __attribute((sbitAT0xEB)); +norace uint8_t volatile EX4 __attribute((sbitAT0xEA)); +norace uint8_t volatile EX3 __attribute((sbitAT0xE9)); +norace uint8_t volatile EX2 __attribute((sbitAT0xE8)); /* EIP */ -uint8_t volatile PWDI __attribute((sbitAT0xFC)); -uint8_t volatile PX5 __attribute((sbitAT0xFB)); -uint8_t volatile PX4 __attribute((sbitAT0xFA)); -uint8_t volatile PX3 __attribute((sbitAT0xF9)); -uint8_t volatile PX2 __attribute((sbitAT0xF8)); +norace uint8_t volatile PWDI __attribute((sbitAT0xFC)); +norace uint8_t volatile PX5 __attribute((sbitAT0xFB)); +norace uint8_t volatile... [truncated message content] |