From: Mathias K. <ke...@fr...> - 2013-02-16 10:26:57
|
Hello, the RAM starts at 2400 and your variable is placed before this address. You can simple use a pointer or define to access this buffer. Anyway the Pointer for the EP0 buffer is defined in the msp430 header files. #include <msp430.h> #include <stdint.h> #include <string.h> #define EP0_MAX_PACKET_SIZE 0x08 #define iep0_buf (((uint8_t*)(int)USBIEP0BUF_)) int main() { memset(iep0_buf, 0, EP0_MAX_PACKET_SIZE); return 0; } Assembly looks like this: 4404: 3d 42 mov #8, r13 ;r2 As==11 4406: 0e 43 clr r14 4408: 3f 40 78 23 mov #9080, r15 ;#0x2378 440c: b0 12 12 44 call #0x4412 Regards, Mathias On 16.02.2013 09:34, Ionut Nicu wrote: > Hi, > > I have a USB driver for the msp430 5xx series which allocates the USB > buffers at the proper addresses in the USB RAM using asm("0xaddr") > statements. > > With the 20120911 compiler, when using "-fdata-sections" the code no > longer compiles. For example, with the following code: > > #include <msp430.h> > #include <stdint.h> > #include <string.h> > > #define EP0_MAX_PACKET_SIZE 0x08 > > static uint8_t iep0_buf[EP0_MAX_PACKET_SIZE] asm("0x2378"); > > int main() > { > memset(&iep0_buf[0], 0, sizeof(iep0_buf)); > return 0; > } > > > ionut@heimdall:~$ msp430-gcc -mmcu=msp430f5528 -fdata-sections -c main.c > -o main.o > /tmp/ccaEQtpB.s: Assembler messages: > /tmp/ccaEQtpB.s:8: Error: Missing symbol name in directive > /tmp/ccaEQtpB.s:8: Error: junk at end of line, first unrecognized > character is `x' > /tmp/ccaEQtpB.s:9: Error: expected comma after name `' in .size > directive > /tmp/ccaEQtpB.s:10: Error: junk at end of line, first unrecognized > character is `0' > > > If I remove the "-fdata-sections" option, the code compiles just fine. > > In my project, since it's being used for multiple devices, there are a > lot of things (code and data) that need to be stripped if they're not > used. That's why I need to use "-fdata-sections -ffunction-sections > -Wl,--gc-sections" to eliminate data and code that isn't used. > > Trying the same code with the x86 gcc shows the same problem, so I guess > this is not mspgcc specific, but rather something that changed in newer > versions of gcc. > > Does anyone have a suggestion on how to solve this? I thought about > declaring sections for each variable in a custom linker file and then > using __attribute__((section(".section_name"))) when declaring the > variables, but I think it's an ugly solution. > > Thanks, > Ionut. > > > ------------------------------------------------------------------------------ > The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, > is your hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials, tech docs, > whitepapers, evaluation guides, and opinion stories. Check out the most > recent posts - join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Mspgcc-users mailing list > Msp...@li... > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > |