Error: Unknown instruction 'fcache #(ShiftOutDataEnd322 - ShiftOutDataStart322) '
DavidZemon
Posts: 2,973
in Propeller 1
I get the following errors when compiling with PropGCC 2344 from a Raspberry Pi 2
The assembled file is attached, and this is the command that is being invoked
pi@raspberrypi:~/software/PropWare/bin $ /opt/parallax/bin/propeller-elf-gcc -v Using built-in specs. COLLECT_GCC=/opt/parallax/bin/propeller-elf-gcc COLLECT_LTO_WRAPPER=/opt/parallax/libexec/gcc/propeller-elf/4.6.1/lto-wrapper Target: propeller-elf Configured with: ../../propgcc/gcc/configure --target=propeller-elf --prefix=/opt/parallax --disable-nls --disable-libssp --disable-lto --disable-shared --with-pkgversion=propellergcc_v1_0_0_2344 --with-bugurl=http://code.google.com/p/propgcc/issues Thread model: single gcc version 4.6.1 (propellergcc_v1_0_0_2344)
The assembled file is attached, and this is the command that is being invoked
/opt/parallax/bin/propeller-elf-gcc -save-temps -Os -m32bit-doubles -Wall -std=gnu++0x -fno-exceptions -fno-rtti -fno-threadsafe-statics -mcog -I/home/pi/software/PropWare -o CMakeFiles/PropWare_cog.dir/__/__/printer/printer.cpp.obj -c /home/pi/software/PropWare/PropWare/printer/printer.cpp


Comments
One solution would be to just skip -mcog for PropWare builds. Another would be to wrap any inline assembly using fcache with #ifndef __PROPELLER_COG__ (and perhaps provide an alternate implementation in the event that __PROPELLER_COG__ is defined, which means that -mcog is in effect).
Here's the file compiled from my Ubuntu 15.10 x64 machine with a recent version of GCC 4 from my build server.
Definitely agreed. But yes, the one on Ubuntu assembles without error. I can provide the pre-processed C++ file tonight if that would help you debug this. Didn't think about that this morning or else I would have already.
(1) Your raspberry pi assembler was out of date, and didn't have the fcache macro
(2) The up to date assembler allowed fcache even in cog mode
I've added errors for use of LMM macros in non-lmm mode, so your Ubuntu builds should error now as they should.
I'm not sure why your raspberry pi assembler was old. Are cross-builds working OK?
I just grabbed that from SimpleIDE. I think I tried the Pi build from my server a couple weeks ago and it didn't work. I'll give it another go tonight.
#ifdef __PROPELLER_COG__ #define FC_START(start, end) #define FC_END(end) #define FC_ADDR(to, start) to #else #define FC_START(start, end) \ " fcache #(" end " - " start ")\n\t" \ " .compress off\n\t" \ start ":\n\t" #define FC_END(end) \ " jmp __LMM_RET\n\t" \ end ":\n\t" \ " .compress default\n\t" #define FC_ADDR(to, start) "__LMM_FCACHE_START+(" to " - " start ")" #endifAnd so an example fcache function looks something like this:
inline void shift_out_data (uint32_t data, uint32_t bits, const uint32_t bitCycles, const uint32_t txMask) const { volatile uint32_t waitCycles = bitCycles; __asm__ volatile ( FC_START("ShiftOutDataStart%=", "ShiftOutDataEnd%=") " add %[_waitCycles], CNT \n\t" "loop%=: \n\t" " waitcnt %[_waitCycles], %[_bitCycles] \n\t" " shr %[_data],#1 wc \n\t" " muxc outa, %[_mask] \n\t" " djnz %[_bits], #" FC_ADDR("loop%=", "ShiftOutDataStart%=") " \n\t" FC_END("ShiftOutDataEnd%=") : [_data] "+r"(data), [_waitCycles] "+r"(waitCycles), [_bits] "+r"(bits) : [_mask] "r"(txMask), [_bitCycles] "r"(bitCycles)); }@ersmith,
Is this something that would be helpful to have in propeller.h?