Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On 2014-04-22, DJ Delorie d...@redhat.com wrote: I was surprised to see DJ's comment that there actually was no standard system interface; the standard interface I was referring to is the one documented at http://neptune.billgatliff.com/newlib.html The key to a successfully ported newlib is providing stubs that bridge the gap between the functionality newlib needs, and what your target system can provide. This bridge is what I was referring to. Newlib calls read() but does not provide an implementation of it. Libgloss provides various target-specific implementations of read(), the one I wrote for msp430 uses CIO to communicate with the simulator/debugger. Why is newlib calling read(), and from what is it expecting to read? I was expecting for MSP430 to also simply implement the functions stubbed in newlib's libnosys, but at first glance it looks like the CIO one uses different names, and maybe doesn't support all the same functions. Hmmm... it should be all the same names. I only changed the existing libgloss hooks. But, I don't always do all the hooks, usually only write() and exit() are needed for our testing. Again, why should newlib be calling write() and what is it expecting to write _to_? What does it expect exit() to do? -- Grant Edwards grant.b.edwardsYow! Did you move a lot of at KOREAN STEAK KNIVES this gmail.comtrip, Dingy? -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On Wed, Apr 23, 2014 at 9:14 AM, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2014-04-22, DJ Delorie d...@redhat.com wrote: I was surprised to see DJ's comment that there actually was no standard system interface; the standard interface I was referring to is the one documented at http://neptune.billgatliff.com/newlib.html The key to a successfully ported newlib is providing stubs that bridge the gap between the functionality newlib needs, and what your target system can provide. This bridge is what I was referring to. Newlib calls read() but does not provide an implementation of it. Libgloss provides various target-specific implementations of read(), the one I wrote for msp430 uses CIO to communicate with the simulator/debugger. Why is newlib calling read(), and from what is it expecting to read? I was expecting for MSP430 to also simply implement the functions stubbed in newlib's libnosys, but at first glance it looks like the CIO one uses different names, and maybe doesn't support all the same functions. Hmmm... it should be all the same names. I only changed the existing libgloss hooks. But, I don't always do all the hooks, usually only write() and exit() are needed for our testing. Again, why should newlib be calling write() and what is it expecting to write _to_? What does it expect exit() to do? Again: whatever the environment wants it to do. In my case, I'm using printf(3c) in my code, and I want it to output to one of the UARTs, which newlib accommodates by using write(2) to descriptor 1, just like any other standard C library. This works because I supply a _write() function that does that. Or maybe it sends the data to an LCD. Maybe exit() starts blinking a red LED if the return code isn't zero. Whatever any of the system functions do, it's my choice, and I like that newlib allows me that control. Peter -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On Wed, Apr 23, 2014 at 02:14:32PM +, Grant Edwards placed into existence: ] On 2014-04-22, DJ Delorie d...@redhat.com wrote: ] ] I was surprised to see DJ's comment that there actually was no ] standard system interface; the standard interface I was referring to ] is the one documented at http://neptune.billgatliff.com/newlib.html ] ] The key to a successfully ported newlib is providing stubs that ] bridge the gap between the functionality newlib needs, and what your ] target system can provide. ] ] This bridge is what I was referring to. Newlib calls read() but does ] not provide an implementation of it. Libgloss provides various ] target-specific implementations of read(), the one I wrote for msp430 ] uses CIO to communicate with the simulator/debugger. ] ] Why is newlib calling read(), and from what is it expecting to read? ] ] I was expecting for MSP430 to also simply implement the functions ] stubbed in newlib's libnosys, but at first glance it looks like the ] CIO one uses different names, and maybe doesn't support all the same ] functions. ] ] Hmmm... it should be all the same names. I only changed the existing ] libgloss hooks. But, I don't always do all the hooks, usually only ] write() and exit() are needed for our testing. ] ] Again, why should newlib be calling write() and what is it expecting ] to write _to_? ] ] What does it expect exit() to do? My understanding is newlib provides STDIO calls such as printf() (using write()), fgets() (using read()), etc. for your convenience, but then you have to implement those low-level syscalls yourself. End result should be that you can use the stdio calls in any manner you feel appropriate, on any hardware you feel this stdio paradigm could have value (output to LCD displays or UARTs, input from a keyboard or UART, etc). Example: on the Tiva-C ARM Cortex-M4F platform, I produced a library for interfacing with a 9-bit SPI accessible black white LCD display (repair part for Nokia 1202 dumbphones) using newlib's infrastructure; my code can then enable something like this: // Display ready for init fopen(LCDBACKLIT, w); // driver grabs stdout for this by default printf(Totally cool! %g\n, 1.059); and suddenly Totally cool! 1.059 appears (line-wrapped) on the LCD. Pictoral example of printf'ing Hi there, using printf!- http://spirilis.net/junk/tiva/nokia1202_tiva_printf.jpg Library for that: https://github.com/spirilis/tiva1202 Newlib stdio stubs implemented here: https://github.com/spirilis/tiva1202/blob/master/devoptab.c The newlib stub functions for _write(), _read() etc. are written in my library to call sub-drivers' write(), read(), etc. so multiple types of hardware can be supported with this infrastructure using the file descriptor concept. So I'm guessing DJ implemented a default hardware I/O implementation in libgloss that uses the CIO infrastructure (no idea what that is, but I'm guessing it uses the JTAG Mailbox system somehow to talk with the debugger host? in which case I'd love to play with it that... assuming mspdebug can support it) -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On 2014-04-23, Peter Bigot big...@acm.org wrote: Again: whatever the environment wants it to do. In my case, I'm using printf(3c) in my code, and I want it to output to one of the UARTs, which newlib accommodates by using write(2) to descriptor 1, just like any other standard C library. This works because I supply a _write() function that does that. But it's not called like a normal C function, it goes through some sort of syscall interface so you don't actually link your _write() function with newlib? Or maybe it sends the data to an LCD. Maybe exit() starts blinking a red LED if the return code isn't zero. Whatever any of the system functions do, it's my choice, and I like that newlib allows me that control. Hmm. Is there an option to build a non-hosted version of newlib which doesn't assume any underlying OS support. -- Grant Edwards grant.b.edwardsYow! Is it 1974? What's at for SUPPER? Can I spend gmail.commy COLLEGE FUND in one wild afternoon?? -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On Wed, Apr 23, 2014 at 9:57 AM, Grant Edwards grant.b.edwa...@gmail.com wrote: On 2014-04-23, Peter Bigot big...@acm.org wrote: Again: whatever the environment wants it to do. In my case, I'm using printf(3c) in my code, and I want it to output to one of the UARTs, which newlib accommodates by using write(2) to descriptor 1, just like any other standard C library. This works because I supply a _write() function that does that. But it's not called like a normal C function, it goes through some sort of syscall interface so you don't actually link your _write() function with newlib? See http://pabigot.github.io/bspacm/newlib.html#newlib_sys Or maybe it sends the data to an LCD. Maybe exit() starts blinking a red LED if the return code isn't zero. Whatever any of the system functions do, it's my choice, and I like that newlib allows me that control. Hmm. Is there an option to build a non-hosted version of newlib which doesn't assume any underlying OS support. Yes, also described at that link, and possibly at the gatliff link I gave earlier. Peter -- Grant Edwards grant.b.edwardsYow! Is it 1974? What's at for SUPPER? Can I spend gmail.commy COLLEGE FUND in one wild afternoon?? -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
So I'm guessing DJ implemented a default hardware I/O implementation in libgloss that uses the CIO infrastructure (no idea what that is, but I'm guessing it uses the JTAG Mailbox system somehow to talk with the debugger host? in which case I'd love to play with it that... assuming mspdebug can support it) In a nutshell... the target fills in a structure at a known address, then executes an opcode at a known address. The debugger/simulator/whatever traps execution at that address, then looks at the structure to decide what to do. In the CIO case, the known addresses are based on symbols in the symbol table. So as long as the debugger can set a breakpoint at a given address, and examine/change target memory, you can implement CIO. -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
But it's not called like a normal C function, it goes through some sort of syscall interface so you don't actually link your _write() function with newlib? It *is* called like a normal C function. You really do just link libgloss.a (or your equivalent) in with your app like you would any other library. -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
On 2014-04-23, DJ Delorie d...@redhat.com wrote: But it's not called like a normal C function, it goes through some sort of syscall interface so you don't actually link your _write() function with newlib? It *is* called like a normal C function. You really do just link libgloss.a (or your equivalent) in with your app like you would any other library. I see. I guess to me a syscall interface implies something other than a normal C function call to a function that's linked with the caller. -- Grant Edwards grant.b.edwardsYow! In Newark the at laundromats are open 24 gmail.comhours a day! -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
I see. I guess to me a syscall interface implies something other than a normal C function call to a function that's linked with the caller. It does to me too. The *implementation* of those standard C functions may involve some sort of interface that's known to the debugger/simulator as well. In the case of msp430-elf-libgloss, that interface is CIO, but it could involve designated interrupts or a simulated I/O peripheral. But that syscall interface is hidden in the libgloss C function calls. In other cases, there might not be a syscall interface, if the C functions interface directly with hardware, such as a serial port or LCD interface. But I don't think any of the implementations involve a separate OS running *on the chip*, which talks to your app with a well-known interface, similar to how (for example) the Linux kernel talks to apps running on a Linux machine. Note, however, that there *is* a newlib port for running on a native x86 Linux platform, which *does* use the Linux kernel syscall API, but not for the MSP430. In *that* port, the _read() et al C functions call the Linux kernel syscall. -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Re: [Mspgcc-users] msp430-elf-gcc upcoming release
Thanks Peter! I've successfully compiled msp430-elf-gcc 4.9 using those instructions on a 64-bit Linux host. For anyone else new to this GCC build, here's the additional steps I used to get the headers linker scripts into the correct place: Download the GCC_RH_20131206.zip file from http://www.ti.com/tool/msp430-gcc-opensource (click Get Software) Modify this shell script (tested under Linux only so far) to install the headers and linker scripts (change paths to install and zipfile): https://gist.github.com/spirilis/115655b9bf206402ff50 This combines memory.ld and peripherals.ld into lib/part#.ld as Peter suggested was needed in his quoted message. It also cleans up the ldscript directories from the include/ dir. I have successfully compiled a binary with it. ... but haven't tried it on actual hardware yet :-) Getting to that soon. On Tue, Apr 22, 2014 at 06:57:55PM +, mspgcc-users-requ...@lists.sourceforge.net placed into existence: ] Date: Tue, 22 Apr 2014 10:34:30 -0500 ] From: Peter Bigot big...@acm.org ] Subject: [Mspgcc-users] msp430-elf-gcc upcoming release ] To: GCC for MSP430 - http://mspgcc.sf.net; ] mspgcc-users@lists.sourceforge.net ] Message-ID: ] CAPOJ94PGLz+BkaKm9hWc2RXg2PSBT=9x_m5h0+fvbydtzng...@mail.gmail.com ] Content-Type: text/plain; charset=UTF-8 ] ] Back in mid April GCC forked off a branch for 4.9.0, which will be the ] first release of GCC that supports the MSP430. I've verified basic ] functionality with: ] ] binutils git://sourceware.org/git/binutils-gdb.git master ] gcc git://gcc.gnu.org/git/gcc.git gcc-4_9-branch ] newlib git://sourceware.org/git/newlib.git master ] ] A couple issues: ] ] * The only headers/linker scripts available are from ] GCC_RH_20131206.zip; memory.ld and peripherals.ld for each MCU need to ] be manually combined to get something binutils can process ] ] * __delay_cycles() didn't get back-ported from the version that TI ] published back in December ] ] msp430-elf-gdb also doesn't appear to work with mspdebug: ] ] (gdb) target remote :2000 ] Remote debugging using :2000 ] Reply contains invalid hex digit 59 ] ] I expect there'll be some issues with newlib as well; it appears to ] use a unique syscall interface that I haven't tried to reverse ] engineer. However, I'm unsure the flags I used are appropriate (they ] derive from the ones used for arm-gcc). I do know that newlib without ] the nano enhancements will not be acceptable for MSP430 work. Insight ] from Red Hat on a complete set of recommended flags known to work ] together would be appreciated. ] ] Below is the script I use for building, with ] /opt/{binutils,gcc,newlib} being git workspaces checking out the ] branches named above. To help ensure the new toolchain is as good as ] possible when it's first released, mspgcc users please try it and ] report problems to Red Hat through whatever mechanism they prefer, ] either here or on the upstream toolchain support lists. ] ] Peter ] ] TODATE=$(date +%Y%m%d) ] PREFIX=/usr/local/msp430-elf-dev-${TODATE} ] rm -rf ${PREFIX} ] export PATH=${PREFIX}/bin:${PATH} ] ] rm -rf binutils mkdir binutils cd binutils ] /opt/binutils/configure --prefix=${PREFIX} --target=msp430-elf 21 | tee co ] make -j8 21 | tee mo ] make install 21 | tee moi ] cd .. ] ] rm -rf gcc mkdir gcc cd gcc ] /opt/gcc/configure --prefix=${PREFIX} --target=msp430-elf ] --with-newlib --enable-languages=c,c++ 21 | tee co ] make -j12 all-host 21 | tee moah ] make install-host 21 | tee moiah ] cd .. ] ] rm -rf newlib mkdir newlib cd newlib ] /opt/newlib/configure \ ] --prefix=${PREFIX} \ ] --target=msp430-elf \ ] --disable-newlib-supplied-syscalls\ ] --enable-newlib-reent-small \ ] --disable-newlib-fvwrite-in-streamio \ ] --disable-newlib-fseek-optimization \ ] --disable-newlib-wide-orient \ ] --enable-newlib-nano-malloc \ ] --disable-newlib-unbuf-stream-opt \ ] --enable-lite-exit\ ] --enable-newlib-global-atexit \ ] --disable-nls ] 21 | tee co ] make 21 | tee mo ] make install 21 | tee moi ] cd .. ] ] cd gcc ] make -j12 all-target 21 | tee moat ] make install-target 21 | tee moiat ] cd .. ] ] ] -- Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform ___ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users