Skip to content

Avoid redefining printf #1629

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

Closed
wants to merge 1 commit into from
Closed

Avoid redefining printf #1629

wants to merge 1 commit into from

Conversation

andig
Copy link
Contributor

@andig andig commented Feb 13, 2016

Needed to avoid userland error when including umm_malloc.h for heap diagnosis.

@igrr
Copy link
Member

igrr commented Feb 13, 2016

Thanks for a reminder, I have opted for less invasive changes (1fc8918).

@igrr igrr closed this Feb 13, 2016
@andig
Copy link
Contributor Author

andig commented Feb 13, 2016

I see. How do you expect users to get diagnostic output- do we have to re-implement the define inside the c file?

@igrr
Copy link
Member

igrr commented Feb 13, 2016

I have simply replaced all ets_printf calls with printf, which works much the same way (both of them call ets_vprintf). As far as output goes, there should be no difference. Enabling debug macros defined in umm_malloc is up to the user, I suppose.

@andig
Copy link
Contributor Author

andig commented Feb 13, 2016

Unfortunately, it does not link for me:

C:\Users\xx\AppData\Local\Temp\build585916e0a596b3409ffab1e615c9d964.tmp/arduino.ar(umm_malloc.c.o):(.text.check_poison$part$0$constprop$4+0x8): undefined reference to `putchar'

C:\Users\xx\AppData\Local\Temp\build585916e0a596b3409ffab1e615c9d964.tmp/arduino.ar(umm_malloc.c.o): In function `dump_mem':

C:\andi\arduino\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_malloc.c:786: undefined reference to `putchar'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

@jeffryr
Copy link

jeffryr commented Feb 13, 2016

Some sketches work, some fail with the undefined reference to `putchar'. A quick unscientific survey:

Blink example works
AdvancedWebServer fails

I suspect any sketch that invokes Serial.begin() will fail to link. Here is the simplest example that fails.

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println("Hello, World!");
  delay(1000);
}

Undo the patch and this links correctly.

@Links2004
Copy link
Collaborator

can confirm:
umm_malloc.c:1708: undefined reference to putchar'`

Links2004 added a commit to Links2004/Arduino that referenced this pull request Feb 14, 2016
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

Successfully merging this pull request may close these issues.

4 participants