-
Notifications
You must be signed in to change notification settings - Fork 71
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
make debug.c components optional to save code size #17
Comments
Both of those sound useful. One of the original design goals (that it looks like I didn't actually write down), was to avoid modifying the WCH code structure too much, so that it would be easier to pull in updates from WCH. From that angle, I would prefer #ifdefs. Separating them into individual library files does seem to be inline with how SDCC works, though. |
I think you could probably do a lot better job if you had written it from scratch. The UART code isn't the only thing that needs work; mDelayuS could use a rewrite too. I also would've named it util.c instead of debug, since it's not specific to debugging. |
Yeah, I agree- This was more of a strategy for keeping the scope of the project small enough so that I could get something working. As long as the example files are modified to work with the changes, it seems reasonable to rename and/or split the files up. We should probably put a short note at the top of the new files to say where they came from originally, for the probably few people who are trying to follow a Keil example. |
Another idea is to make most of the functions inline. |
I was able to reduce the compiled size of the blink example from 700B to 232B by conditionally excluding the UART functions. Another 36B can be saved by excluding the WDT functions. Instead of adding #ifdef BUILD_UART around the code, another option would be to break up debug.c into separate files and build it as a library. Then the linker will only pull in .rel files that are actually used.
The text was updated successfully, but these errors were encountered: