Menu

Error while tring to build for AT128

Tobias
2024-02-18
2024-04-05
  • Tobias

    Tobias - 2024-02-18

    I try to build Flashforth for the ATmega128RFA1 (for the Smartresponse XE) with MPLAB X IDE 5.35.
    I use the Projekt in flashforth/avr/FF-ATMEGA.X.
    When I click build (or clean and build) I get the following errors:

    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory 'FORTH/flashforth/avr/FF-ATMEGA.X'
    make  -f nbproject/Makefile-default.mk dist/default/production/FF-ATMEGA.X.production.hex
    make[2]: Entering directory 'FORTH/flashforth/avr/FF-ATMEGA.X'
    "/Applications/microchip/xc8/v2.46/bin/xc8-cc" -c  -mcpu=ATmega128RFA1  -x assembler-with-cpp -D__ATmega128RFA1__    -O0 -fpack-struct -funsigned-char -funsigned-bitfields -I"../src" -Wall -DXPRJ_default=default  -gdwarf-3 -Wa,--defsym=__MPLAB_BUILD=1 -DOPERATOR_UART=""   -MD -MP -MF "build/default/production/_ext/1360937237/ff-xc8.o.d" -MT "build/default/production/_ext/1360937237/ff-xc8.o.d" -MT build/default/production/_ext/1360937237/ff-xc8.o -o build/default/production/_ext/1360937237/ff-xc8.o  ../src/ff-xc8.asm 
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h: Assembler messages:
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:59: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:65: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:71: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:78: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:84: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:90: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:96: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:102: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:108: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:116: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:160: Error: unknown opcode `extern'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:161: Error: unknown opcode `uint8_t'
    /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:178: Error: unknown opcode `extern'
    ../src/ff-xc8.asm:5158: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5158: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5158: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5344: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5344: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5344: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5385: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5385: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5385: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5769: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5769: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5769: Error: non-constant expression in ".if" statement
    ../src/ff-xc8.asm:5158: Error: invalid operands (*ABS* and *UND* sections) for `<<'
    ../src/ff-xc8.asm:5344: Error: invalid operands (*ABS* and *UND* sections) for `<<'
    ../src/ff-xc8.asm:5385: Error: invalid operands (*ABS* and *UND* sections) for `<<'
    ../src/ff-xc8.asm:5769: Error: invalid operands (*ABS* and *UND* sections) for `<<'
    make[2]: *** [nbproject/Makefile-default.mk:114: build/default/production/_ext/1360937237/ff-xc8.o] Error 1
    make[1]: *** [nbproject/Makefile-default.mk:91: .build-conf] Error 2
    make: *** [nbproject/Makefile-impl.mk:39: .build-impl] Error 2
    make[2]: Leaving directory 'FORTH/flashforth/avr/FF-ATMEGA.X'
    make[1]: Leaving directory 'FORTH/flashforth/avr/FF-ATMEGA.X'
    
    BUILD FAILED (exit value 2, total time: 836ms)
    

    What am I doing wrong?

    The ../src/ff-xc8.asm:5158: Error: non-constant expression in ".if" statement might be a configuration problem.

    The other two leave me complete baffeld.

     

    Last edit: Tobias 2024-02-18
  • Tobias

    Tobias - 2024-02-18

    Update: I found a configuration problem, which solves some of the problems.
    But the errors with /Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:59: Error: unknown opcodeextern'` remain.

     
  • Mikael Nordman

    Mikael Nordman - 2024-02-18

    I did the build for ATmega128RFA1.
    In the config-xc8.inc file I had to disable the load led.
    And I had to comment the registers WDTCR in the words WD+ and WD-.
    Apparently the WDTCR register does not exist in the ATmega128RFA1.

    With these change it builds and runs in the simulator. MPLABX 6.15 and XC8 2.45 on linux.

    CLEAN SUCCESSFUL (total time: 53ms)
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]: Entering directory '/home/mikael/ff/avr/FF-ATMEGA.X'
    make  -f nbproject/Makefile-default.mk dist/default/debug/FF-ATMEGA.X.debug.elf
    make[2]: Entering directory '/home/mikael/ff/avr/FF-ATMEGA.X'
    "/opt/microchip/xc8/v2.45/bin/xc8-cc" -c  -mcpu=ATmega128RFA1  -D__DEBUG=1 -g -DDEBUG -D__MPLAB_DEBUGGER_SIMULATOR=1 -gdwarf-2  -x assembler-with-cpp -D__ATmega128RFA1__   -mdfp="/opt/microchip/mplabx/v6.15/packs/Microchip/ATmega_DFP/3.0.158/xc8"  -O0 -funsigned-char -funsigned-bitfields -I"../src" -Wall -DXPRJ_default=default  -gdwarf-3 -mconst-data-in-progmem -mno-const-data-in-config-mapped-progmem -Wa,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_SIMULATOR=1 -DOPERATOR_UART=""   -MD -MP -MF "build/default/debug/_ext/1360937237/ff-xc8.o.d" -MT "build/default/debug/_ext/1360937237/ff-xc8.o.d" -MT build/default/debug/_ext/1360937237/ff-xc8.o -o build/default/debug/_ext/1360937237/ff-xc8.o  ../src/ff-xc8.asm 
    "/opt/microchip/xc8/v2.45/bin/xc8-cc"  -mcpu=ATmega128RFA1 -Wl,-Map=dist/default/debug/FF-ATMEGA.X.debug.map  -D__DEBUG=1  -DXPRJ_default=default  -Wl,--defsym=__MPLAB_BUILD=1   -mdfp="/opt/microchip/mplabx/v6.15/packs/Microchip/ATmega_DFP/3.0.158/xc8"  -D__MPLAB_DEBUGGER_SIMULATOR=1 -gdwarf-2 -O0 -funsigned-char -funsigned-bitfields -I"../src" -Wall -DOPERATOR_UART="" -gdwarf-3 -mconst-data-in-progmem -mno-const-data-in-config-mapped-progmem -nostartfiles      -Wl,--memorysummary,dist/default/debug/memoryfile.xml -o dist/default/debug/FF-ATMEGA.X.debug.elf  -o dist/default/debug/FF-ATMEGA.X.debug.elf  build/default/debug/_ext/1360937237/ff-xc8.o      -Wl,--start-group  -Wl,--end-group  -Wl,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_SIMULATOR=1
    Info: Loading file: /opt/microchip/xc8/v2.45/avr/avr/bin/../lib/ldscripts/avr51.xn
    make[2]: Leaving directory '/home/mikael/ff/avr/FF-ATMEGA.X'
    make[1]: Leaving directory '/home/mikael/ff/avr/FF-ATMEGA.X'
    
    BUILD SUCCESSFUL (total time: 467ms)
    Loading symbols from /home/mikael/ff/avr/FF-ATMEGA.X/dist/default/debug/FF-ATMEGA.X.debug.elf...
    Loading code from /home/mikael/ff/avr/FF-ATMEGA.X/dist/default/debug/FF-ATMEGA.X.debug.elf...
    Program loaded with pack,ATmega_DFP,3.0.158,Microchip
    Loading completed
    

    There should be no need to add any additional include files.
    Have made any changes to the FF files ?

     
  • ronny suy

    ronny suy - 2024-03-06

    Hi ,
    I'm trying to compile FF for pic24 , and also have a lot of these errors : Error: non-constant expression in ".if" statement.
    What is this configuration problem if I may ask.
    I can not find a solution so far.
    Regards,
    Ronny

     
  • Lief Koepsel

    Lief Koepsel - 2024-03-11

    I had similar issues with attempting to compile. I had the following errors:
    "/Applications/microchip/xc8/v2.46/avr/avr/include/avr/builtins.h:59: Error: unknown opcode extern'"

    I also noticed that above Mikael's version of XC8 was 2.45. I went to the Microchip Download Archives, downloaded and installed 2.45, and everything works.

    Fun.
    Lief

     
  • Mikael Nordman

    Mikael Nordman - 2024-03-11

    XC v2.46 has made the below change, that causes the problem with builtins.h .

    Need to check what can be done about it. Maybe xc.h should not be included from assembly code.

    For now XC8 v2.45 must be used to compile FlashForth.

    MISRA-compliant headers (XC8-3279) To ensure that the compiler can conform to language
    specifications such as MISRA, the headers of the non-functional safety compiler have been
    updated to ensure that the <builtins.h> header file is automatically included by <xc.h>,
    that builtin_avr_flash_segments is defined only on architectures that support __memx
    (that is, all architectures except avrtiny), and that declarations of the builtins are provided
    in avr-libc.
    
     

    Last edit: Mikael Nordman 2024-03-11
  • Mikael Nordman

    Mikael Nordman - 2024-03-11

    If you replace

    #include <xc.h>
    

    with

    #include <avr/io.h>
    

    then it compiles with XC v2.46.

    BR Mikael

     
  • Lief Koepsel

    Lief Koepsel - 2024-04-05

    Version c499963, dated April 1, 2024 has been confirmed on macOS, to compile with xc8 2.46.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.