User forums > Embedded development
Problems building sdcc c file with codeblocks
yipinx:
Hi, I'm trying to compile a C source file with a z80 target (list.c in core/lib from http://www.contiki-os.org/ ). The file is part of a small protothreaded os and if compiled from the command line (msysgit) like this :
$ sdcc -mz80 -ID../../core -c list.c
it outputs all files as expected.
However, when in codeblocks, I right click on the file and choose from the menu 'build file' and after the message 'compiling core\lib\list.c' the help output of sdas assembler appears. I found a similar question in http://forums.codeblocks.org/index.php?topic=14970.0 but that fix doesn't appear to work for me, if I knew what to do with to begin with.
My setup on a winxpsp3 is as follows
D:\Code\msysgit (with mingw installed, codeblocks doesn't find it automagically but by hand it can be set and works as expected!)
D:\Code\sdcc (SDCC : mcs51/gbz80/z80/z180/r2k/ds390/pic16/pic14/TININative/ds400/hc08 3.1.0 #7066 (Nov 22 2011) (MINGW32))
D:\Code\codeblocks (10.05)
this is part of my .cbp file:
<Build>
<Target title="MSX2 - Debug">
<Option output="bin\Debug\LIBDSK" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Debug\" />
<Option type="1" />
<Option compiler="sdcc" />
<Compiler>
<Add option="--out-fmt-ihx" />
<Add option="--no-std-crt0" />
<Add option="-mz80" />
<Add option="--debug" />
<Add option="--reserve-regs-iy --std-sdcc99" />
<Add option="-DAUTOSTART_ENABLE" />
<Add directory="platform\native" />
<Add directory="cpu\native" />
<Add directory="core" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
I tried to remove the Compiler option -Wall and restart codeblocks.. but that generates a unhandled exception. :(
anyone any idea how to fix this, or am i doing something wrong maybe?
cheers,
Johan
MortenMacFly:
On the console you have 2 compiler switches:
--- Quote from: yipinx on February 16, 2012, 07:36:16 pm ---$ sdcc -mz80 -ID../../core -c list.c
--- End quote ---
In the project you have at 9 compiler switches:
--- Quote from: yipinx on February 16, 2012, 07:36:16 pm --- <Compiler>
<Add option="--out-fmt-ihx" />
<Add option="--no-std-crt0" />
<Add option="-mz80" />
<Add option="--debug" />
<Add option="--reserve-regs-iy --std-sdcc99" />
<Add option="-DAUTOSTART_ENABLE" />
<Add directory="platform\native" />
<Add directory="cpu\native" />
<Add directory="core" />
</Compiler>
--- End quote ---
You are comparing apples and oranges here. Fix your project setup.
scarphin:
First of all there is no '-Wall' switch for SDCC. That was my fault to include it which I thought was enabling 'all warnings'. In SDCC 'all warnings' are enabled by default so no '-Wall' switch.
Second I too think there must be something wrong with ur compiler switches.
yipinx:
@macfly: my bad. I compiled the same c file again with the same compiler flags as in the .cbp file I previously posted but only the included core/ directory like so:
$ sdcc -mz80 --debug --out-fmt-ihx --no-std-crt0 --debug --reserve-regs-iy -std-sdcc99 -DAUTOSTART_ENABLE -ID:../../core -c list.c
I got this warning:
at 1: warning 118: option '-s' no longer supported 'use --code-loc instead'
but that is correct and should not be a problem for the build log I think.
To be sure, I removed the include paths from the codeblocks project file.
I tried the other way around as well, and removed all but -mz80 -D... and -I from the command line options and from the codeblocks project file but that didn't seem to help... even restarting codeblocks didn't do the trick (since it crashes a lot on these experiments :( ).
@scarphin: I know, --Wall is not part of sdcc. But it is defined below and outside the scope of the <Build/> element. I guess that suggests that it is a project wide compiler directive. But I don't know how to check that. The build log doesn't show how sdcc was invoked.
scarphin:
What do u mean it is defined outside the scope? There shouldn't be any '-Wall' defined for an SDCC project or u'll get assembler error because it tries to pass the 'll' directive to the assembler which doesn't know what to do with it.
Navigation
[0] Message Index
[#] Next page
Go to full version