??? 02/27/07 07:33 Read: times |
#133774 - SDCC C Complie Procedure Responding to: ???'s previous message |
There is a complie procedure... I think you have to compile the dependant external C files in to object files 1st and then compile them along with the main C file.
SDCC can only work on one file at a time. Here's a cut and paste stright from the SDCC manual. With the main topic being : 3.1.2 Projects with Multiple Source Files 3.1 Compiling ================ 3.1.1 Single Source File Projects --------------------------------------- For single source file 8051 projects the process is very simple. Compile your programs with the following command "sdcc sourcefile.c". This will compile, assemble and link your source file. Output files are as follows: • sourcefile.asm - Assembler source file created by the compiler • sourcefile.lst - Assembler listing file created by the Assembler • sourcefile.rst - Assembler listing file updated with linkedit information, created by linkage editor • sourcefile.sym - symbol listing for the sourcefile, created by the assembler • sourcefile.rel or sourcefile.o - Object file created by the assembler, input to Linkage editor • sourcefile.map - The memory map for the load module, created by the Linker • sourcefile.mem - A file with a summary of the memory usage • sourcefile.ihx - The load module in Intel hex format (you can select the Motorola S19 format with --out-fmts19. If you need another format you might want to use objdump or srecord). Both formats are documented in the documentation of srecord • sourcefile.adb - An intermediate file containing debug information needed to create the .cdb file (with -- debug) • sourcefile.cdb - An optional file (with --debug) containing debug information. The format is documented in cdbfileformat.pdf • sourcefile. - (no extension) An optional AOMF or AOMF51 file containing debug information (generated with option --debug). The (Intel) absolute object module f ormat is commonly used by third party tools (debuggers, simulators, emulators) • sourcefile.dump* - Dump file to debug the compiler it self (generated with option --dumpall) (see section 3.2.9 and section 9.1 ”Anatomy of the compiler”). 3.1.2 Projects with Multiple Source Files --------------------------------------------- SDCC can compile only ONE file at a time. Let us for example assume that you have a project containing the following files: foo1.c (contains some functions) foo2.c (contains some more functions) foomain.c (contains more functions and the function main) 19 3.1. COMPILING CHAPTER 3. USING SDCC The first two files will need to be compiled separately with the commands: sdcc -c foo1.c sdcc -c foo2.c Then compile the source file containing the main() function and link the files together with the following command: sdcc foomain.c foo1.rel foo2.rel Alternatively, foomain.c can be separately compiled as well: sdcc -c foomain.c sdcc foomain.rel foo1.rel foo2.rel The file containing the main() function MUST be the FIRST file specified in the command line, since the linkage editor processes file in the order they are presented to it. The linker is invoked from SDCC using a script file with extension .lnk. You can view this file to troubleshoot linking problems such as those arising from missing libraries. ----- Regards Joe |
Topic | Author | Date |
SDCC Compiler questions | 01/01/70 00:00 | |
Need more details | 01/01/70 00:00 | |
SDCC C Complie Procedure | 01/01/70 00:00 | |
lose all sign of life? | 01/01/70 00:00 | |
code size limited SDCC? | 01/01/70 00:00 | |
answer to where to get | 01/01/70 00:00 | |
packihx, srec_cat | 01/01/70 00:00 | |
Following up.... | 01/01/70 00:00 | |
short/long options | 01/01/70 00:00 | |
re: short/long options | 01/01/70 00:00 | |
I do not recall who it was ... | 01/01/70 00:00 | |
No which or why | 01/01/70 00:00 | |
re: No which or why | 01/01/70 00:00 | |
if it's not the watchdog | 01/01/70 00:00 | |
Partial solution | 01/01/70 00:00 | |
just a few more rough ideas | 01/01/70 00:00 | |
interrupts | 01/01/70 00:00 | |
re: Interrupts | 01/01/70 00:00 | |
function main() | 01/01/70 00:00 | |
Juergen | 01/01/70 00:00 | |
... and the test ride?![]() | 01/01/70 00:00 |