Re: [Mspgcc-users] TI compiler
Ugh... Really sorry, hit reply instead of reply list. Greetings, Apologies for hijacking this e-mail chain, but I have had issues with the ``bloat'' in newlib as well. My issue is with internationalization support in newlib. I have configured and compiled newlib with the following flags: export CFLAGS_FOR_TARGET="-Os -g -ffunction-sections -fdata-sections" ../configure \ --prefix=/usr \ --target=msp430-elf \ --disable-newlib-supplied-syscalls \ --enable-newlib-reent-small \ --disable-newlib-fseek-optimization \ --disable-newlib-wide-orient \ --enable-newlib-nano-formatted-io \ --disable-newlib-io-float \ --enable-newlib-nano-malloc \ --disable-newlib-unbuf-stream-opt \ --enable-lite-exit \ --enable-newlib-global-atexit \ --disable-nls It was my understanding that --disable-nls would disable internationalization support. Unfortunately, I am observing the following behaviour with the attached code: $ msp430-elf-gcc -Os -o uart uart.c -mmcu=msp430g2553 $ size uart textdata bss dec hex filename 778 16 90 884 374 uart $ msp430-elf-gcc -Os -o uart uart.c -mmcu=msp430g2553 -DUSE_TOUPPER $ size uart textdata bss dec hex filename 1476 398 921966 7ae uart The function toupper() is pulling in 382 bytes into .data. This accounts for 74.6% of this particular microcontroller's SRAM. This is not very nice. Furthermore, I have not really looked into it, but should this new data actually be mutable? If not, it could very well go into .rodata and stay in flash memory. Ideally, I should be able to disable internationalization support alltoguether even if it goes against the C and POSIX standards. Is there any way to actually do that I am missing? Thank you. Cheers, Orlando. On 03/03/2017 01:30 PM, DJ Delorie wrote: > > This has come up before, and here's what's going on... the new > msp430-elf-gcc includes all the code required by the standard, partly > because... well, standards... and partly so that the testsuite can test > everything. The old msp-gcc made lots of assumptions about how the > compiler would actually be used, and "pre-optimized" the runtime for it. > > So you end up with things like "argv handling" when there's no command > line, or "exit closes files" when you never exit. A big change is using > a float-enabled printf when you don't need it. > > I put some notes here, way back when, but they're old, and IIRC it's > been improved even more since then: > > http://people.redhat.com/~dj/msp430/size-optimizations.html > > Also, you can use "msp430-elf-gcc -mintr ..." to minimize the runtime > support. > > Also, if you're REALLY constrained to size, you might consider getting > the crt0.S source file from newlib and modifying it yourself to really > strip out the parts you don't need. Most embedded code really only > needs to set up the stack and watchdog, then jump to main(). > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > signature.asc Description: OpenPGP digital signature -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] Missing type declaration for function symbols
Greetings, I have been having similar issues with the msp430-elf as well, but regarding line numbers. It may be related to this issue. I reported it upstream [1,2] but really did not get any feedback on the issue. Maybe our issues are related? [1] https://www.sourceware.org/ml/gdb/2015-09/msg00030.html [2] https://sourceware.org/bugzilla/show_bug.cgi?id=19033 Cheers, Orlando. On 01/22/2016 12:38 PM, Ingo van Lil wrote: > Hi, > > when compiling a C/C++ file, the resulting symbols in the object file > have the type "NOTYPE". It should be "FUNC" instead: > > readelf --syms test.o | grep my_function > 7: 2 NOTYPE GLOBAL DEFAULT1 my_function > > The generated assembler code contains the following declarations for a > function: > > .file "test.c" > .text > .balign 2 > .global my_function > > There should be a type declaration like ".type my_function, @function". > The mspdebug utility will ignore symbols without proper type when > reading ELF symbol tables. > > Regards, > Ingo > > -- > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140 > ___ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > signature.asc Description: OpenPGP digital signature -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] Fwd: New MSP430 GCC version release available!
Greetings, First and foremost I would like to personally thank Peter Bigot for his efforts on maintaining the mspgcc toolchain before TI/RedHat took over and developed their own and then for still caring enough to aid with community builds for the msp430-elf toolchain. I feel this must be addressed, given that this effort has been made even when, I believe, there is some friction between TI/RedHat and Mr. Bigot himself. That being said, I would like to mention that I have released a few PKGBUILDs for Arch Linux which are able to build packages that can be installed in that system. These may be found in the AUR [1]. I am using binutils 2.25, gcc 5.2.0, newlib 2.2.0.20150824 and the latest snapshot of TI headers and linker scripts. If you decide to use these in your Arch Linux system, please report any bugs you find with these PKGBUILDs and packages over in the AUR and not here. Also, I am sorry, but I am unable to provide packages for other distributions as I only utilize Arch Linux. With that being said, thank you again for all your efforts, good sir. Cheers, Orlando. [1] https://aur.archlinux.org/packages/?K=msp430-elf On 09/21/2015 04:05 PM, Peter Bigot wrote: > My archive of msp430-elf releases at https://github.com/pabigot/msp430-elf > has been updated to include 3.05.00.00. The bottom of the README includes > a description of the version numbering used by TI. This new release does > include a few fixes/enhancements in the compiler, the first since > 3.02.03.00, but is fundamentally the same GCC version as the original TI > release one year ago. > > I no longer use MSP430 and at some point will stop updating my archive. > Earlier this summer I was using the upstream gcc+binutils (5.0.0-based at > the time, selected specifically for C++14 support), built as documented at > http://pabigot.github.io/bsp430/msp430elf.html. Stock GNU tools work fine > with MSP430 now, though they sometimes do lag in applying patches that > appear in the TI fork. Only the device-specific headers and linker scripts > from TI (also in my archive) are necessary when using upstream versions. > > Peter > > > On Sun, Sep 20, 2015 at 11:31 PM, Mark Rageswrote: > >> On Sun, Sep 20, 2015 at 10:17 AM, Ghannouchi, Youssef >> wrote: >>> Hello GCC-enthusiasts, >>> We are pleased to announce a new stand-alone & open source release >> (v3.5.0.0) of MSP430 GCC available for download here< >> http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/3_05_00_00/index_FDS.html >>> ! >>> The stand-alone package includes all binaries, the source code and >> MSP430 device specific support files. >>> The MSP430 GCC build is also available in CCSv6 App Center on all >> platforms (Windows, Linux and Mac OSX). >> >> What version of GCC is it? Neither 3.5.0 nor 14r1-364 are GCC version >> numbers. Development of GCC 3.x ended a decade ago. >> >> Regards, >> Mark >> >> >> -- >> ___ >> Mspgcc-users mailing list >> Mspgcc-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mspgcc-users >> > > > > -- > > > > ___ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > signature.asc Description: OpenPGP digital signature -- ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] weird code with MSPGCC
Hello, You have a bug in your code, you are taking the address of the pointer and zeroing it. This is a dangerous thing to do, the proper way is to do: memset(mybuffer, 0, 10); or memset(mybuffer[0], 0, 10); The compiler should have given you a warning about that without the cast. Listen to it and do not try to force things. As for why the elimination of memset()/memcpy(), the compiler is doing that because you are telling it to optimize. Since you do not use the buffer at all in the function, it does not need to be zeroed. In fact, the two mov instructions can also be optimized away. The first add instruction allocates the buffer in the stack and the last one removes it. When you do not tell the compiler to optimize the code (-O0), it will not make the optimizations and you see your memset()/memcpy() work properly. You will be able to see it at work with optimizations enabled if you were to declare your buffer as a global, that is uint8_t mybuffer[10]; void test_memcpy(void) { memset(mybuffer, 1, 10);/* globals are initialized */ /* to 0 by default */ } Again, not using the buffer may imply optimizing it away... Cheers. On 06/26/2014 03:48 AM, Kees Schoenmakers wrote: Hello, I experienced some odd effect when msp430-gcc tries to inline memcpy and/or memset. the code #include stdint.h void test_memcpy(void) { uint8_t mybuffer[10]; memset((uint8_t*)mybuffer, 0, 10); } when compiled with msp430-gcc -c -O2 -mmcu=msp430f449 mspgcc_memcpy.c results in Disassembly of section .text: test_memcpy: 0: 31 50 f6 ff add #-10, r1 ;#0xfff6 4: 81 43 06 00 mov #0, 6(r1) ;r3 As==00, 0x0006(r1) 8: 81 43 08 00 mov #0, 8(r1) ;r3 As==00, 0x0008(r1) c: 31 50 0a 00 add #10,r1 ;#0x000a 10: 30 41 ret In my opion thats not clearing 10 bytes Without optimation the code appears sound. msp430-gcc (GCC) 4.7.0 20120322 (mspgcc dev 20120911) Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Same size problem I noticed with memcpy if inlined best regards Kees -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users signature.asc Description: OpenPGP digital signature -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] Size of global variable
I would like to add to this list the possibility of a stack/heap collision if dynamic allocation is being used. I am not sure on the specifics of the project at hand [I will not ask either], but if the timer interrupt stops working that essentially means something turned off the interrupt somewhere/the timer configuration got changed. I would try to use the WDT to reset the device and dump the timer registers upon power on to see what happened. On Mon, 2013-07-29 at 21:25 +, Grant Edwards wrote: On 2013-07-29, ravim ravi.mandl...@gmail.com wrote: I will try to do what you have suggested. Issue is we fear that so much is happening in our code too fast (flash write, blacklist check, then communication with different devices etc), we fear we might be corrupting stack somehow with so many global and local variables. That doesn't really make much sense. It doesn't matter how many things you do or how fast you do them. Things that will cause intermitten failure after running for a while: * stack overflow (or underflow) * dereferencing uninitialized pointers * buffer overflow (or underflow) * race conditions To check for stack overflow, the the easiest thing to do is to initialize your stack space with a recognizable pattern. You can then periodically check to see how much of the stack still contains that initial pattern. If you can stop program execution when it fails, you can check the stack space to make sure that some of it still contains the initialization pattern. Is there any way through which we can figure out what is actually happening (read the stack etc), why things go smooth for an hour or so. If we change sampling window, timing varies but eventually, it will stop. If it's not stack overflow, then my _guess_ is that you probably have a race condition between forground and interrupt, between two interrupts (if you allow interrupts to nest), or between two threads (if you've got a multi-threaded system). signature.asc Description: This is a digitally signed message part -- Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711iu=/4140/ostg.clktrk___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] Linking
You need to explicitly link the other object files into the final elf as well. msp430-gcc -Os -Wall -g -mmcu=msp430f5438a main.o bluetooth.o comm.o characters.o output.o -o main.elf On Wed, 2013-04-17 at 20:20 -0400, Ian Chapman wrote: Hi all, My Makefile produces all the dot.o files from the dot.c files with a few warnings. However the link stage fails to find the functions called by main.c that are specified in the dot.h and defined in the dot.c files and by then should be in dot.o files. Makefile CC=msp430-gcc CFLAGS=-Os -Wall -g -mmcu=msp430f5438a main : main.o bluetooth.o comm.o characters.o output.o $(CC) $(CFLAGS) main.c -o main.elf main.o : main.c main.h $(CC) $(CFLAGS) -c main.c etc Result msp430-gcc -Os -Wall -g -mmcu=msp430f5438a main.c -o main.elf /tmp/ccx0kuof.o: In function `main': /home/stan/msp430/TDU/main.c:202: undefined reference to `vEnterCommandMode' /home/stan/msp430/TDU/main.c:203: undefined reference to `vSendCommand' collect2: ld returned 1 exit status make: *** [main] Error 1 I guess I'm missing a flag to indicate that the dot.o files are in the working directory but that should be the gcc default. Any ideas? Ian. -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users signature.asc Description: This is a digitally signed message part -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] On volatile for long type.
The reason is because the variable a is not modified inside the loop, so the compiler may optimise that away by doing a jump to self instead of anding and jumping to self if not zero, or it may cache the value of the variable somewhere and do the same. If the variable is modified somewhere else, namely an interrupt, the behaviour will not be the desired one. Declaring it as volatile will ensure the resulting assembly will read the value of the variable every time before anding. That should be 0x81, by the way. On Oct 24, 2012 2:16 AM, mind entropy mindentr...@gmail.com wrote: Hi, I was reading the mspgcc manual ( http://www.eecs.harvard.edu/~konrad/projects/motetrack/mspgcc-manual-20031127.pdf ) and on Pg 39 its written as If you execute while ((long) a 0x8l); the program will hang, unless ’a’ is declared volatile. So, do it! I did not get it. Why should it hang? Thanks, Gautam. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] Strange log() bug?
main.o: In function `main': /Users/rwessels/tmp/log_bug/main.c:9: undefined reference to `log' you probably did not link the math library. try adding -lm when you're linking. Actually: [tron@HAL9000 log]$ cat log.c #include msp430.h #include math.h unsigned int foo = 10; int main() { double var = log(foo); var++; return 0; } [tron@HAL9000 log]$ msp430-gcc -Os -lm -mmcu=msp430g2553 -o log log.c /tmp/ccprYmUi.o: In function `main': log.c:(.init9+0xc): undefined reference to `log' collect2: ld returned 1 exit status [tron@HAL9000 log]$ pacman -Q gcc-msp430 msp430-libc gcc-msp430 4.6.3-3 msp430-libc 20120224-2 [tron@HAL9000 log]$ pacman -Ql msp430-libc | grep libm [snip] msp430-libc /usr/msp430/lib/libm.a [snip] [tron@HAL9000 log]$ msp430-gcc -L/usr/msp430/lib -Os -lm -mmcu=msp430g2553 -o log log.c /tmp/ccgcsd6H.o: In function `main': log.c:(.init9+0xc): undefined reference to `log' collect2: ld returned 1 exit status Not exactly sure why, but this issue happened to me before as I was linking a static library I wrote. signature.asc Description: This is a digitally signed message part -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] Strange log() bug?
Hey, Peter, thanks for that answer. I just tested it on my system the snippet compiles just fine if using logf(). Now, sorry to derail the conversation, but I am still having issues with the library I wrote. Compiling the library: [tron@HAL9000 libhd44780]$ make Making release build... msp430-gcc -Os -c hd44780.c -o hd44780.o -mmcu=msp430g2231 -DF_CPU=100UL -std=gnu99 -Wall msp430-ar -r libhd44780-4bit.a hd44780.o msp430-size hd44780.o textdata bss dec hex filename 572 0 2 574 23e hd44780.o Done. Compiling the core file: [tron@HAL9000 hd-test]$ make Making release build... msp430-gcc -Os -c core.c -I../libhd44780 -mmcu=msp430g2231 -DF_CPU=100 -std=gnu99 -Wall core.c:39:6: warning: return type of 'main' is not 'int' [-Wmain] msp430-gcc -L../libhd44780 -lhd44780-4bit -mmcu=msp430g2231 core.o -o hd-test.elf core.o: In function `main': core.c:(.init9+0x8): undefined reference to `hd_init' core.c:(.init9+0x16): undefined reference to `putchar' collect2: ld returned 1 exit status make: *** [link] Error 1 Amusingly, if I link directly to the .o file generated when compiling the library, it works ok: [tron@HAL9000 hd-test]$ make debug Making debug build... msp430-gcc -g -c core.c -I../libhd44780 -mmcu=msp430g2231 -DF_CPU=100 -std=gnu99 -Wall core.c:39:6: warning: return type of 'main' is not 'int' [-Wmain] msp430-gcc -mmcu=msp430g2231 ../libhd44780/hd44780.o core.o -o hd-test.elf FIRMWARE SIZE msp430-size hd-test.elf textdata bss dec hex filename 782 44 4 830 33e hd-test.elf Is there anything I am missing? On Sun, 2012-09-16 at 19:48 -0500, Peter Bigot wrote: There is no double (64-bit) support in the mspgcc toolchain, only float (32-bit), with double being equivalent. While most math libraries have both float and double entrypoints (e.g., sin() is simply a wrapper around sinf()), it appears log() only exists as logf(). Please file this as a bug on the tracker, but it won't be high priority since it appears to have always been this way. Since double isn't supported, it's probably best to not use it, rather than mislead the maintainer into thinking it's actually available. Use float, and then use the corresponding functions like logf. Peter signature.asc Description: This is a digitally signed message part -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users