Nathan Huntoon

Help with as and ld

Discussion created by Nathan Huntoon on Oct 31, 2006
Latest reply on Jan 5, 2015 by TomE

I'm teaching a lab for a computer architecture course, and we use the CF5435 chip as a nice microprocessor to get students familiar with low level, yet somewhat advance programming. I need to teach the class using only assembly, as most of the students are hardware EE's and don't know how to program in C. That rules out CodeWarrior, and I've been searching for a replacement set of tools to compile assembly source code, and use it on our boards. So far, I've found GNU as and ld, and 'cfasm' from I like the cfasm better because it's a one stop deal for going from a .asm file to a .s19. The problem is, it only supports a very basic set of opcodes, and I was hoping to utilize more of the advance functions on the newer chip. The as and ld set from GNU seem to support more recent chips, but I can't get them to work. After a lot of reading and playing, I was able to compile a .asm file into a .o file with as. I used the following command: "as -0 asmtest.o -m5204 al asmtest2.s" The target is different because I'm compiling to run on a simulator of the 5204 I found.
I think this is ok. What I am now struggling with is getting the .o file into a .s19 file. I have read most of the ld manual on GNU tools website, and done several experiments but can't get a file to be created. My best guess as to a correct implementation of ld is
: "ld -e 0x10000 -o asmtest.s19 --oformat srec asmtest.o" When I run this though I get the following error "ld: cannot perform PE operations on non PE output file 'asmtest.s19'" I've tried removing options from the ld command one at a time, and this warning always shows up. When I don't specify an output with -o, I get the same error only pointing to 'a.exe' which is the default output.


If anyone has been successful in getting as and ld to work for the CF, I would love to hear how. I'd like to make it work from the command line before I start trying to write scripts. Just to aid in my understanding, so I can pass it on to my students.