This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linker warning: **** uses 2-byte wchar_t yet the output is to use 4-byte wchar_t

I'm attempting to setup Eclipse to compile programs for my EK-LM4F120XL

Here's the full warning: (I created a symlink to driverlib-cm4f.lib so that ld could find it)

/home/david/stellaris/toolchain/bin/arm-none-eabi-ld: warning: /home/david/stellaris/StellarisWare/driverlib/ccs-cm4f/Debug/libcm4f.a(gpio.obj) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail

And the command that caused the error:

/home/david/stellaris/toolchain/bin/arm-none-eabi-ld -L/home/david/stellaris/StellarisWare/driverlib/ccs-cm4f/Debug -L/home/david/stellaris/toolchain/arm-none-eabi/lib --static --gc-sections -T/home/david/stellaris/toolchain/arm-none-eabi/lib/LM4F.ld -o "Blinky.elf"  ./Blinky.o ./LM4F_startup.o   -lcm4f -lc

And finally, my compile command:

/home/david/stellaris/toolchain/bin/arm-none-eabi-gcc -DPART_LM4F120H5QR -DARM_MATH_CM4 -DTARGET_IS_BLIZZARD_RA1 -I/home/david/stellaris/StellarisWare -I/home/david/stellaris/toolchain/arm-none-eabi/include -O0 -g3 -Wall -c -fmessage-length=0 -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -MMD -MP -MF"Blinky.d" -MT"Blinky.d" -o "Blinky.o" "../Blinky.c"

If I use the StellarisWare APIs, this warning comes up and it does not run correctly. If I access memory directly (as in the blinky example in StellarisWare - not using any header files other than lm4f120h5qr.h), there are no warnings and it compiles perfectly.

What does the warning mean? How can fix it?

Thanks,
David 

  • I'm still at a loss here. Does anyone have ideas why the stellarisware API isn't working?

  • Hello David,

    From the output, it looks like GCC is trying to link to a library in the driverlib/ccs-cm4f directory. I would expect a library in that directory to have been built by the CCS toolchain. If that's the case, you might want to rebuild the driverlib library with GCC and link to that binary.

  • You would be right about that - I had problems building StellarisWare from scratch and ended up copying the folder from my CCS installation. I'll go back and see if I can get StellarisWare re-compiled.

    I was also very curious what wchar_t means. obviously, I know what the char variable is. Every time I've seen it though, it's been 1 byte though - not 2 or 4.

  • Recompiling StellarisWare didn't work. The problem I was having earlier was that I had mixed up the summon arm toolchain with Code Sourcery one. After uninstalling Code Sourcery, StellarisWare compiled just fine, but did not fix my problem. Here's the output now:

    Building target: Blinky.elf
    Invoking: Cross GCC Linker
    /home/david/stellaris/toolchain/bin/arm-none-eabi-ld -L/home/david/stellaris/StellarisWare-120/driverlib/ccs-cm4f/Debug -L/home/david/stellaris/toolchain/arm-none-eabi/lib --static --gc-sections -T/home/david/stellaris/toolchain/arm-none-eabi/lib/LM4F.ld -o "Blinky.elf" ./Blinky.o ./LM4F_startup.o -lcm4f -lc
    ../LM4F_startup.c:71:3: warning: (near initialization for 'myvectors[0]') [-pedantic]
    /home/david/stellaris/toolchain/bin/arm-none-eabi-ld: error: /home/david/stellaris/StellarisWare-120/driverlib/ccs-cm4f/Debug/libcm4f.a(sysctl.obj) uses VFP register arguments, Blinky.elf does not
    /home/david/stellaris/toolchain/bin/arm-none-eabi-ld: warning: /home/david/stellaris/StellarisWare-120/driverlib/ccs-cm4f/Debug/libcm4f.a(sysctl.obj) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    /home/david/stellaris/toolchain/bin/arm-none-eabi-ld: failed to merge target specific data of file /home/david/stellaris/StellarisWare-120/driverlib/ccs-cm4f/Debug/libcm4f.a(sysctl.obj)

  • Hi,

    It seems to have wrong settings/configuration(s): the usual practice is to never call ld directly - do it through gcc; the same apply to asm. For instance, my linker command is:

    arm-none-eabi-gcc -T"<path-to-proj/src/lm4f232.ld" -nostartfiles -Xlinker --gc-sections, -Wl, -Map,ProjName.map, -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g3 -gdwarf-2

    Also, as you can see, my liker command file is located inside the project because is microcontroller specific - each project/microcontroller having specific amounts of flash/ram/heap/stacks. I don't know why your is located there  .../arm-none-eabi/lib/LM4F.ld - it is weird, never seen in that place, I'am not sure it is a good one.

    To make your life easier my suggestion is to use first ready-made binaries; also useful is to install this plug-in - it gives you some predefined settings and you don't need to write makefiles.

    Petrei

  • Well, I'm getting closer. Thank you Petrei for the Eclipse plugin - that'll save a LOT of time.

    I put my linker script there because I figured I'd use that one most every time and thought it would be easier to keep it in a central location. I've moved it to the project directory now.

    After switching to your suggested Eclipse plugin, I can now compile and link successfully. It even creates the hex and bin files without failing. However, I'm making objdump segfault somehow :(

    Invoking: ARM Summon Linux GNU Create Listing
    arm-none-eabi-objdump -h -S Blinky_arm.elf > "Blinky_arm.lst"
    /home/david/stellaris/toolchain/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld: warning: /home/david/stellaris/StellarisWare-120/driverlib/ccs-cm4f/Debug/libcm4f.a(cpu.obj) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
    Segmentation fault (core dumped)
    make: *** [Blinky_arm.lst] Error 139

    Also, though the bin file is created successfully, it does not run correctly. I've uploaded the source and eclipse project files to github in case they are of any help:

    https://github.com/SwimDude0614/Blinky_lm4f

  • Hi,

    Two small problems still:

    a) in your code, take care about pin 0 of port F - this is NMI at startup, you should unlock it before any use (don't know if ..PIN_LED is pin 0 or not). 

    b) in linker file from Scompo maybe there is a small mistake - in the data section the line: *(.data.*) should be *(.data*), without any supplementary dot.

    It would be better to download from TI either the specific software file related to LM4F launchpad, either StellarisWare package - a lot of info and examples.

    One more question: are you sure you made Summon package without any bugs? at least after all modifications to Eclipse did you re-compiled the library?

    Petrei

  • A) Thanks for the heads up! I'm not using PF0 thankfully, but that's good to know.

    B) Fixed. Didn't change anything.

    As for "download from TI either the specific software file related to LM4F launchpad, either StellarisWare package", what exactly do you mean? I've downloaded two versions of StellarisWare: SW-EK-LM4F120XL-9453.exe and SW-LM3S-9107.exe and, for the moment, am using the library specific to the 120. I also have a LM4F232 that I'm using to finish up a school project (I need the accelerometer off it or else I would just use the 120) and will eventually work on getting that up and running as well.

    I just finished a complete recompilation of the toolchain and I'm running into exactly the same problem still. If there is a different toolchain worth trying, I'd be *happy* to do that. I checked the Ubuntu 12.10 repository and it has binutils-arm-linux-gnueabi and binutils-arm-linux-gnueabihf - but I have no idea what the difference between the two is.

    Thanks again for the help.

    David

  • Hi,

    Sorry to give you bad news: here it is what I can read at the https://github.com/esden/summon-arm-toolchain#readme: 

    A very simple build script for bare metal arm toolchain. NO LINUX! — Read more

    http://summon-arm-toolchain.org/

    so you can find the right one. I have no experience with Ubuntu (I use MAC..) - you should look for ARM EABI packages and not for ARM GNU LINUX since these are for Linux kernel. If you have CodeSourcery EABI for Linux that will be OK.

    As for Stellaris packages, there is one SW-LM3S-9453.exe - the latest one (as I know) - you should be consistent with only one package and do not mix them.

    Petrei

  • Hi,

    Re-read the summon readme - seems to be OK for Linux, but I cannot figure out what is wrong with your tool chain. Try a ready-made binary package to see the results.

    Petrei

  • Okay, I will try that stuff tomorrow and report back.

  • I deeply apologize. This should have been fixed many posts ago.

    When the suggestion to compile StellarisWare from scratch came about (due to the library folder being "...../ccs-cm4f/Debug/"), I never thought that the library inside that folder would not be compiled along with the rest of StellarisWare. I assumed that if I ran make, it would recompile "..../ccs-cm4f/Debug/libdriver-cm4f.lib" with the correct toolchain. It just occured to me that I should try some of the other folders and it's working fine now. I'm using "..../ewarm-cm4f/Exe/libdriver-cm4f.a" and life is good.

    There was also a missing line in the code code - I forgot GPIOPinTypeGPIOOutput().

    Thanks again for the help. I'm off to [finally] go write some code!!!

  • Hi,

    You can add also this plugin to your tool chain: http://sourceforge.net/projects/embsysregview/

    Petrei