MSP430 in gcc4.9 ... enable interrupts?
I have built a crosscompiler for the MSP430, using a gcc4.9 snapshot (gcc-4.9-20140112) and the compiler seems OK and builds a simple "blinky" LED flashing example. But my slightly larger example, originally built using Peter Bigot's mspgcc backend, no longer compiles ... mspgcc had a number of intrinsic functions, such as __nop(), __eint() and __dint() respectively. Calling these would execute a nop, enable and disable interrupts respectively. Others such as __bis_status_register(), __bic_status_register() would manipulate system status, low power modes etc. Now in the MSP430 port for gcc4.9, these intrinsic functions have gone. Perusing the config/msp430 source files, e.g. config/msp430/msp430.md I can see evidence that the _functionality_ is still there, e.g. (define_insn "enable_interrupts" [(unspec_volatile [(const_int 0)] UNS_EINT)] "" "EINT" ) ... (define_insn "bis_SR" [(unspec_volatile [(match_operand 0 "nonmemory_operand" "ir")] UNS_BIS_SR)] "" "BIS.W\t%0, %O0(SP)" ) ... but how do I access it? In other words, what C code fragment would cause the "enable_interrupts" instruction to be emitted, and generate "EINT" in the assembler or object output? - Brian
Re: gnattools cannot be built for freestanding/bare metal environment without hacking up the build machinery
Luke A. Guest archeia.com> writes: > > Hi, > > I've been over this before and have got nowhere with it. > Say you want to build an Ada compiler for embedded work, ... > You can build it with "make all-gcc" and install with "make install-gcc" > ... > But what about the gnattools? Not buildable. A message in the ml > archives states to build them with "make -C gcc gnattools," but this > fails: > ... > You can't disable libada using the command line as that also disables > gnattools - I don't know the reason for requiring this behaviour. > Revisiting the MSP430 as it's now an official gcc target, this is still a problem here too, so there are at least 3 targets for which it's a problem. Looking at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19959 and comparing comments #6 and #14, perhaps this command should be "make -C gcc gnattools-cross" ? I'll try to do a clean build and test this today. But it would be better if the build "just worked" so at > if test "${ENABLE_LIBADA}" != "yes" ; then > noconfigdirs="$noconfigdirs" > fi we need a better test here (also checking for a crosscompiler build). > I think that we need a configure flag to disable libada and not > gnattools for these bare board targets. Following comment #15 in bug 19959, perhaps it's time to open a bug against --disable-libada. - Brian
Re: MSP430 in gcc4.9 ... enable interrupts?
On Fri, 2014-02-14 at 14:17 -0500, DJ Delorie wrote: > The constructs in the *.md files are for the compiler's internal use > (i.e. there are function attributes that trigger those). You don't > need compiler support for these opcodes at the user level; the right > way is to implement those builtins as inline assembler > static inline __attribute__((always_inline)) > void __nop() > { > asm volatile ("NOP"); > } Thanks for the answer. I thought I was missing something, but apparently not. Now it's clear that inline assembler is the official way, I can adapt that approach to my situation. - Brian