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

Explanation & Assumptions #2

Open
andrewcharnley opened this issue Mar 24, 2016 · 3 comments
Open

Explanation & Assumptions #2

andrewcharnley opened this issue Mar 24, 2016 · 3 comments

Comments

@andrewcharnley
Copy link

Hi

re: https://github.com/diegoherranz/sdcc-examples/blob/master/pic14/1.blink_led/blink_led.c

I'm new to the game and have my env setup. The include file you use doesn't exist, and sdcc has include/pic14/pic12f629.h (or 675) instead?

Andrew

@andrewcharnley
Copy link
Author

Ok, there is a one but it's pic14/pic16regs.h and this pulls the relevant file in via the -p command line (i.e -p12f629). Your generic loading of the pic16regs.h wont work.

@diegoherranz
Copy link
Owner

Hi,

It works for me so it might be related to a different SDCC version?

In the blink_led.c, modifying the Makefile to use PROC=12f629:

#include <pic14regs.h> loads sdcc/non-free/include/pic14/pic14regs.h which loads sdcc/non-free/include/pic14/pic12f629.h. OK.

If I modify blink_led.c to #include <pic16regs.h> instead, it works as well:

#include <pic16regs.h> loads sdcc/include/pic14/pic16regs.h which loads sdcc/non-free/include/pic14/pic12f629.h. OK.

I didn't know about pic16regs.h, I had always used pic14regs.h. I'll try to understand the difference but both work for me.

Can you indicate which SDCC version you're using?

@axs-gentoo
Copy link

Something of particular interest here is that pic16regs.h is not located within the non-free section -- I expect that using this header allows for using free support when it exists and falls back to non-free if it doesn't (or errors more usefully if non-free isn't available, maybe??)

The pic14regs.h is a rather interesting dynamic hack that essentially uses the preprocessor to "build itself" based on all of the files that are in the pic14/ directory. So although it may not look like it works, it does work. That said, having it spelled out in pic16regs.h looks to be safer and/or easier to follow, though I can't comment as to why it's called pic16regs.h given it is all pic14 chips, unless the overarching idea here is to make building 14bit and 16bit hex possible from the same C code?

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