bschwand / STM8-SPL-SDCC

STM8S SPL for SDCC
45 stars 12 forks source link

Fix newer SDCC compatibility (properly) and board detection #8

Closed rrendec closed 2 years ago

rrendec commented 2 years ago

I'm proposing a new patch set to fix compatibility with newer SDCC versions and board detection in the test application. These issues were partly addressed in the previous pull request (that was merged on Nov 7). However, I believe the getchar() fix is incorrect. While it does make the test program work, it potentially breaks future use of other C library functions that rely on getchar(). The assumption is that the modified getchar() must be made available to the entire C library, not just the test program. I had these changes sitting in my local repo for a few months, but never thought about creating a pull request :-/

The other fix is related to board detection in the test program and has not been addressed previously. The DEVICE variable from the Makefile is not exposed to the C compiler, only its value is - which then becomes a macro at the C preprocessor level.