Problem with assembler files when compiling a C project with SDCC and Codeblocks

I was trying to compile a simple C project (SDCC for Z80) with codeblocks. As usual, I stumble easily on minor problems, taking much time to look up for a solution. This time, it’s a small project that doesn’t want to compile.

Here is the code:

#include

void putchar(char c);


void main(void)
 {
 printf("Hello world\r\n");
 }

void putchar(char c)
 {
 c;
 __asm
 call    0x0529
 __endasm;
 }

What could be simpler? When compiling the file, it generate these messages:

||=== Build: Release in test-vinc (compiler: SDCC Compiler) ===|
 obj/Release/main.asm|156|Error:  missing or improper operators, terminators, or delimiters|
 ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Of course, the project worked fine previously and there’s absolutely nothing wrong in my code. Here are my software versions:

Codeblocks 16.01
SDCC 3.3.2 #8942 (Feb 13 2014)

Well, the solution was simple.

To correct this problem, be sure to specify the particular CPU you’re using. In my case, Z80.

In CodeBlocks’ menu, select Project, Build options,

sdcc-cpu

That’s it! Now it works!

Advertisements
This entry was posted in Electronics, Software and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s