Rikard Bosnjakovic wrote: > In MPLAB's manual and other places I've seen that it is possible to > combine both C and assembler. Thus having foo.asm (compiled to foo.obj) > and bar.c (compiled to bar.obj), it's possible to link them both to the > same final executable. > > But here's the problem. For the test-project, I have set the PICC to be > the language tool MPLAB should use, but when I add a .asm-file to the > project and try to "build all", the C-compiler tells me that it cannot > handle the *.asm. I thought that for these files the MPASM-program > should be run, but obviously not. I cannot seem to switch the language > tool suite for a single file, either, so I'm a bit of stuck here. > > Do you need two separate projects to be able to use separate C- and > asm-code? I'm aware that the PICC can use inline assembler and the like, > but that's currently not the option. I have only 45 days to evaluate > PICC, so I need to try every possible combination ;-) The HiTech and MPLAB object file formats are not the same, which means the linkers are not exchangeable, so you're stuck with the following options: - Create .c files with inline assembler. This is by far the easiest option, in many respects, and usually sufficient. It also helps you integrate the asm code with your C code, and it takes care of most of the asm instructions that have to do with the linker setup. You can simply define a C function and have the complete body in assembler. Note though that this is HiTech assembler. AFAIR the opcode mnemonics are the same, though. (Note that you don't have to use asm(...) on each line; there's also #asm, which allows you to include a whole bunch of assembler.) - Create HiTech assembler files (as Brent showed). This is a bit trickier, as you now have to set up the linking properly (for example the PSECT instructions that you see in his code). - Link separate programs and combine them with HiTech's (or another) hex file utility. Use a jump table at a fixed address to interface them. This is still trickier, but is the only way you can interface MPASM libraries with HiTech C code without porting them to HiTech asm. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist