0

I have this .asm file containing:

$INCLUDE (dev_opt.inc)

OPT CSEG OPT_BYTE
DB DEV_OPT_VAL_C0
DB DEV_OPT_VAL_C1

$_IF (DEV_OPT_BOOTSWAP_ENABLE = 1)
OPT2 CSEG AT 020C0H
$ENDIF

END

when building the assembly:

as -I"C:\inc" -o "$@" "$<"

I got this error:

../src/dev_Opt.asm:65: Error: invalid character '$' in mnemonic
../src/dev_Opt.asm:72: Error: no such instruction: `opt CSEG OPT_BYTE'
../src/dev_Opt.asm:73: Error: no such instruction: `db MCU_OPT_VAL_C0'
../src/dev_Opt.asm:74: Error: no such instruction: `db MCU_OPT_VAL_C1'
../src/dev_Opt.asm:76: Error: invalid character '$' in mnemonic
../src/dev_Opt.asm:77: Error: no such instruction: `opt2 CSEG AT 020C0H'
../src/dev_Opt.asm:78: Error: invalid character '$' in mnemonic
../src/dev_Opt.asm:79: Error: no such instruction: `end '
Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
kimondoe
  • 567
  • 2
  • 9
  • 27
  • 1
    Which assembler is GCC using? The GNU binutils assember? And what is the target platform? Different assembler programs have very different syntax for meta-instructions and even for the actual machine instructions. You can't just download an assembler source file made for a specific assembler program, and hope it will work in another. Especially the GNU binutils `as` assembler, which on x86 (both 32 and 64 bit systems) doesn't use Intel syntax but [AT&T syntax](https://en.wikibooks.org/wiki/X86_Assembly/GAS_Syntax). – Some programmer dude Jul 08 '16 at 01:37
  • 1
    GNU as manual: https://sourceware.org/binutils/docs/as/. See also the [x86 tag wiki](http://stackoverflow.com/tags/x86/info). IDK why you think this should have worked... – Peter Cordes Jul 08 '16 at 01:48
  • I am sorry for the newb question. I am very unfamiliar with assembly. Regarding GCC used: I used the cygwin downloaded gcc-core GNU Compiler collection. for the target platform it is rl78 e1 – kimondoe Jul 08 '16 at 02:02
  • 2
    The Cygwin version of GCC targets x86 CPUs, the same ones that Cygwin runs on. That means the assembler also targets x86 CPUs, and so doesn't work with RL78 assembly code. You'd need to build your own Cygwn-hosted RL78-targeted version of the GNU assembler. But even then it wouldn't work because the GNU RL78 assembly syntax is markedly different than the code you're trying to assemble. – Ross Ridge Jul 08 '16 at 02:12
  • Doesn't GAS use `.include` instead of `$include`? And using `END` at the end of the file doesn't sound like GAS either. I'm with @JoachimPileborg: we need more context. Where did you get this code and what is it supposed to do? – David Wohlferd Jul 08 '16 at 02:14
  • 2
    Looks like you'd need the IAR Assembler to assemble the code you are showing. – Michael Petch Jul 08 '16 at 02:27
  • it's part of an existing code in C that is for rl78 platform but I need to build it for x86 for integration testing purposes. Is this possible? Is this also valid for integration testing? – kimondoe Jul 08 '16 at 03:44
  • 1
    Only x86 asm can be assembled into x86 machine code and linked into an x86 executable. rl78 asm code can't run natively on x86, only in an emulator. – Peter Cordes Jul 08 '16 at 03:56

0 Answers0