0

I am currently building a processor model for the coldfire V2 architecture but I am running into issues testing it primarily because I can't seem to compile any coldfire code. All of the cross-compilers I find for GNU are targeted at 68k which is not the same as the coldfire architecture (they lie in the same general family but the specific ISA for each are definitely distinct and thus many instructions throw errors). Does anyone know of any GNU toolchains that will work?

GNU itself says it provides support for targeting these architectures but when i use the -march=5225 flag it doesn't work (just says all instructions unknown)

PandaRaid
  • 618
  • 1
  • 9
  • 22
  • `5225` looks like something you'd use with `-mcpu` rather than `-march`. Have you tried specifying an ISA version instead (e.g. `-march=isac`) ? – Michael Aug 07 '14 at 05:55
  • I have tried using the ISA version with the -march flag with no success. I also tried using the 5225 with mcpu but GCC said that was a deprecated flag. – PandaRaid Aug 07 '14 at 15:47
  • Which exact instruction is it failing on? And which version of the GNU binutils are you using? I tried assembling a file that contained an `mvz.w` instruction (which according to the ColdFire Programmer's Reference Manual was added in ISA_B) using binutils 2.22 and the `-march=isab` flag, and it appeared to work just fine. – Michael Aug 07 '14 at 16:51
  • I have binutils 2.23 and the file just had a simple addi.l and add.l both were throwing a "no such instruction" error. What version of GCC you using, and what was the exact command you ran? – PandaRaid Aug 07 '14 at 20:14
  • I wasn't using GCC. I was using `as` directly, from binutils 2.22. The command I used was simply `m68k-elf-as --march=isab -o test.o test.s`. Are you sure that the instructions you're using are valid for the ColdFire? For example, `ADDI` on the 680x0 allows many different addressing modes for the destination operand, but on the ColdFire the destination operand can only be a `D`-register. – Michael Aug 08 '14 at 05:07
  • Okay so i tried the command you used and instead of getting the "no such instruction" error I got an "operands mistmatch" error. My instruction was just an addi.l #64, d0. Could i see your test file? Also put it in an answer so I can accept it if it works :) thanks for help! – PandaRaid Aug 08 '14 at 21:00
  • It's complaining about `d0` because you left out the register prefix (`%`). So that should be `%d0` to be recognized as the `D0` register. Alternatively you could add the `--register-prefix-optional` command-line option when assembling. – Michael Aug 08 '14 at 21:41
  • Perfect! That did the trick, you should post it as an answer and I'll go ahead and accept it :) – PandaRaid Aug 09 '14 at 17:17

1 Answers1

1

Assembling ColdFire code works with the GNU 68k assembler.

You can start by looking in the ColdFire Programmer's Reference Manual to find out in which version of the ISA (instruction set architecture) the instructions you're using were made available.

If you then run the GNU 68k assembler with the --help switch you'll see a list of arguments for the -march switch to specify the ISA you need. For example, -march=isab would select ISA_B. ColdFire support might require a non-ancient version of the GNU assembler. I used the one from binutils 2.22.

Keep in mind that some 68k instructions have fewer addressing modes available when using a ColdFire ISA.

Michael
  • 57,169
  • 9
  • 80
  • 125