There is nothing below the text section, except maybe info memory, ram and SFRs... Check the elf file using msp430-objdump to see where your code starts. It should match up with the datasheet, if not check the link script. ORG would not place the code like you want. You could use a "section" attribute to direct the linker where to put a function/variable, but you shouldn't need to do this unless you have special cause to do so. Check GNU ld docs for more info.
#ifndef... #define... #endif only protects against multiple inclusions of a header for each C file individually. If the string definition appears in multiple C files (objects after compiling) then the linker will complain. Hope that helps. - Wayne Sent via BlackBerry® from Vodafone -----Original Message----- From: "Larry" <[email protected]> Date: Sat, 14 Feb 2009 10:47:23 To: <[email protected]>; 'GCC for MSP430 - http://mspgcc.sf.net'<[email protected]> Subject: RE: [Mspgcc-users] multiple definition of ... Wayne, Thanks for your reply. I'll [lay with this, over the weekend and let you know the results. I am indeed overrunning the .text area, right on top of the interrupt vectors. I have plenty of memory available below the .text area, but don't know how to direct the compiler to place at least some of my text in the available area, rather than trying to stuff it all in .text. A lot of this is diagnostic testing which the end user does not have ready access to, it could be stripped off, but would make the end product less friendly for field people. I initially had all of the definitions in a .c file but didn't add externs until I had tried several things. This is when out of desperation, I placed the definitions (I know that this is bad) in a .h file, just to see what would happen. Usually I have one main include file that includes all of the peripheral include files. The peripheral include files each are framed with a #ifndef ..., #define .... #endif statements which prevent them from being loaded twice, even if called more that once. I will go back to the .c file, with the externs in an include file and let you know the results. It sure would be nice to know how to direct the compiler to put the text lower down in program memory, perhaps an inline assembly ORG statement? Thanks, Larry -----Original Message----- From: Wayne Uroda [mailto:[email protected]] Sent: Friday, February 13, 2009 6:52 PM To: GCC for MSP430 - http://mspgcc.sf.net Subject: Re: [Mspgcc-users] multiple definition of ... If the header file is included in multiple C files, this is why you are seeing the multiple definition error. It is more correct to put the definition in one C file only, then put a declaration in the header file: Strings.c: const char AverageCurrentDisp[] = "Bat Avg Current"; Strings.h: extern const char AverageCurrentDisp[]; This will ensure there is only one definition of the string, but it can be used in any file if you include strings.h. I don't quite understand your other question, .text is ROM (.data and .bss are RAM). Hopefully if you define your strings this way the problem will vanish? If not, try removing code until your project compiles, it may be possible that you have simply run out of code space. Try turning optimisation on with -O2 cflag. Good luck! Let us know if you have more troubles. - Wayne Sent via BlackBerryR from Vodafone -----Original Message----- From: Flugeldorph <[email protected]> Date: Fri, 13 Feb 2009 10:54:22 To: <[email protected]> Subject: [Mspgcc-users] multiple definition of ... Hello, I have been using the IAR compiler for my work with an msp430F135 mcu. The client that I am working for was going to purchase a license to IAR, but thought the price too high. So, a few days ago, I began the task of setting up a gcc environment (including CodeBlocks), and adjusting my code to work with the new environment. I had definde all of my strings that I displayed on an LCD using #defines like: #define AverageCurrentDisp "Bat Avg Current" I soon discovered that when I used these precompiler directives in gcc, the string was given an address which began at 0xfc00, and quickly over running the .text section. So, I looked in the manual, and found out that if I defined the strings as constants, they would be allocated in the main ROM space... SO, I created a module 'Constants.h' like const char AverageCurrentDisp[] = "Bat Avg Current"; Now I have a new problem. In spite of the fact that I use a #ifndef __Constant__h #define __Constant__h #endif around my new .h file, I am getting an error message: obj\Debug\Display.o:(.text+0x30): multiple definition of `AverageCurrentDisp' What am I doing wrong, and why does it seem as though the string is still being placed in the .text section? -- View this message in context: http://www.nabble.com/multiple-definition-of-...-tp22002722p22002722.html Sent from the MSP430 gcc - Users mailing list archive at Nabble.com. ---------------------------------------------------------------------------- -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users ---------------------------------------------------------------------------- -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users
