-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
lint.h is not working, VSCode shows error on every SDCC keyword #45
Comments
I get the same problem. My workaround is add a new macro before SDCC #if defined (__SDCC_SYNTAX_FIX)
#include <stdbool.h>
#include <lint.h>
# warning unrecognized compiler
#define __BIT bool
#define __IDATA
#define __PDATA
#define __XDATA
#define __CODE
#define __REENTRANT
#define SBIT(name, addr, bit) volatile bool name
#define SFR(name, addr) volatile unsigned char name
#define SFRX(addr) (*(unsigned char volatile *)(addr))
#define SFR16X(addr) (*(unsigned char volatile *)(addr))
#define INTERRUPT(name, vector) void name (void)
#define INTERRUPT_USING(name, vector, regnum) void name (void)
#define NOP()
#elif defined (SDCC) || defined (__SDCC)
#define __BIT __bit
#define __IDATA __idata
#define __PDATA __pdata
#define __XDATA __xdata
#define __CODE __code
#define __REENTRANT __reentrant
#define SBIT(name, addr, bit) __sbit __at(addr+bit) name
#define SFR(name, addr) __sfr __at(addr) name
#define SFRX(addr) (*(unsigned char volatile __xdata *)(addr))
#define SFR16X(addr) (*(unsigned int volatile __xdata *)(addr))
#define INTERRUPT(name, vector) void name (void) __interrupt (vector)
#define INTERRUPT_USING(name, vector, regnum) void name (void) __interrupt (vector) __using (regnum)
#define NOP() __asm NOP __endasm
//...
#endif Then create a separate env for code editing
and build/upload with another env. |
A simple demonstration: #include <stdbool.h>
#undef __SDCC_mcs51
#include <lint.h>
#define __SDCC_mcs
#include <8052.h>
#define MAIN_Fosc 16000000uL
#define led P1_0
void delay_ms(unsigned int ms);
void main() {
while (1) {
led = true;
delay_ms(500);
led = false;
delay_ms(500);
}
}
void delay_ms(unsigned int ms) {
unsigned int i;
do {
i = MAIN_Fosc / 13000;
while (--i);
} while (--ms);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SDCC related defines, like __SDCC and __SDCC_mcs51, were added somewhere which causes lint.h is useless.
A simple workaround is undef __SDCC_mcs51 before including lint.h, then re-define it, like:
but this way all the SDCC keyword below will disapear.
The text was updated successfully, but these errors were encountered: