Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdcc compiler sseg error with 4.0 #76

Closed
jsadv opened this issue Apr 12, 2019 · 2 comments
Closed

sdcc compiler sseg error with 4.0 #76

jsadv opened this issue Apr 12, 2019 · 2 comments

Comments

@jsadv
Copy link

jsadv commented Apr 12, 2019

[code]
void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}
[/code]

ASlink-Warning-No definition of area SSEG
exit status 1
Error compiling for board STM8S105K4T6 Breakout Board.

loads default blink tho....???????

@jsadv jsadv closed this as completed Apr 12, 2019
@JonasCz
Copy link

JonasCz commented Sep 23, 2020

I have the same problem: it compiles bigger code fine, but empty program or LED blink fails with;

ASlink-Warning-No definition of area SSEG

Did you ever fix this, and how?

@tenbaht
Copy link
Owner

tenbaht commented Oct 14, 2020

This happens when there is no *.pde or *.ino file in the project directory and only *.c files are compiled.

This message means that main.c is not pulled in by the linker because there was no reference to main() anywhere. When processing *.pde/ino files wrapper/sdcc.sh (for IDE builds) or sduino.mk (for Makefile builds) adds a reference to main:

/* add a dummy reference to main() to make sure to pull in main.c from the core library */
void main(void);
void (*dummy_variable) () = main;

If there is no pde/ino file the user has to make sure main.c is pulled in by the linker or define its own main().

Possible ways to pull in main.c:
a) Use Serial_begin(): This references the variable runSerialEvent which in turn pulls in main.c (some overhead)
b) reference the variable runSerialEvent yourself: begin(){runSerialEvent=0;} (Overhead: 4 bytes flash)
c) add a reference to main() like above. (Overhead: 2 bytes RAM and 2 bytes flash)
d) define your own main() function.

This issue keeps popping up over and over again. This might require a FAQ entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants