do not compile with stack auto, change functions to be nonreentrant, use fixed parameters

- frees up ~4KB of code space
This commit is contained in:
Jeff Wang 2019-05-02 03:27:01 -04:00
parent 6399cbf44f
commit 0049f3df98
15 changed files with 121 additions and 104 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
# 3rd party tools
find_package(Qt5 COMPONENTS Widgets Qml Quick REQUIRED)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -std=c++11 -fsanitize=address,undefined")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -fsanitize=address,undefined")
# Directory with source code
add_subdirectory(src)

View File

@ -1,6 +1,6 @@
SDCC ?= sdcc
STCCODESIZE ?= 13312
SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --idata-loc 0x80
SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --idata-loc 0x80
#SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --model-large
FLASHFILE ?= main.hex
LARGE_LDFLAGS += -L/usr/share/sdcc/lib/large/

View File

@ -16,6 +16,8 @@
#define STACK_Z 2
#define STACK_T 3
uint8_t NoLift = 0;
//stack "grows" towards 0
__xdata dec80 Stack[STACK_SIZE]; //0->x, 1->y, 2->z, 3->t initially
uint8_t StackPtr = 0;
@ -27,22 +29,18 @@ static void pop(){
StackPtr++; //adjust pointer
}
void push_decn(const char* signif_str, exp_t exponent, uint8_t no_lift){
if (!no_lift){
void push_decn(__xdata const char* signif_str, exp_t exponent){
if (!NoLift){
StackPtr--;
}
set_x(signif_str, exponent);
build_dec80(signif_str, exponent);
copy_decn(&stack(STACK_X), &AccDecn);
}
void clear_x(void){
set_dec80_zero(&stack(STACK_X));
}
void set_x(const char* signif_str, exp_t exponent){
build_dec80(signif_str, exponent);
copy_decn(&stack(STACK_X), &AccDecn);
}
__xdata dec80* get_x(void){
return &stack(STACK_X);
}

View File

@ -16,10 +16,11 @@ extern "C" {
void process_cmd(char cmd);
void push_decn(const char* signif_str, exp_t exponent, uint8_t no_lift);
//push_decn is equivalent to "set_x()" if no_lift is true
void push_decn(__xdata const char* signif_str, exp_t exponent);
extern uint8_t NoLift;
void clear_x(void);
void set_x(const char* signif_str, exp_t exponent);
__xdata dec80* get_x(void);
__xdata dec80* get_y(void);

View File

@ -46,6 +46,9 @@ static const uint8_t num_digits_display = 16;
__idata dec80 AccDecn, BDecn;
__xdata char Buf[DECN_BUF_SIZE];
void copy_decn(dec80* dest, const dec80* src){
uint8_t i;
dest->exponent = src->exponent;
@ -152,7 +155,7 @@ static void remove_leading_zeros(dec80* x){
set_exponent(x, exponent, is_negative);
}
void build_dec80(const char* signif_str, exp_t exponent){
void build_dec80(__xdata const char* signif_str, exp_t exponent){
enum {
SIGN_ZERO,
SIGN_ZERO_SEEN_POINT,
@ -515,7 +518,6 @@ static void sub_mag(dec80* acc, const dec80* x){
_incr_exp(&tmp, get_exponent(acc));
}
#ifdef DEBUG_ADD
extern char Buf[DECN_BUF_SIZE];
decn_to_str_complete(Buf, &tmp);
printf(" incr_exp tmp: %s\n", Buf);
#endif
@ -604,7 +606,6 @@ void add_decn(void){
remove_leading_zeros(&AccDecn);
remove_leading_zeros(&tmp);
#ifdef DEBUG_ADD
extern char Buf[DECN_BUF_SIZE];
decn_to_str_complete(Buf, &AccDecn);
printf(" rem_leading_zeros acc: %s\n", Buf);
decn_to_str_complete(Buf, &tmp);
@ -620,7 +621,6 @@ void add_decn(void){
set_exponent(&AccDecn, get_exponent(&tmp), (AccDecn.exponent < 0));
}
#ifdef DEBUG_ADD
extern char Buf[DECN_BUF_SIZE];
decn_to_str_complete(Buf, &AccDecn);
printf(" incr_exp acc: %s\n", Buf);
decn_to_str_complete(Buf, &tmp);
@ -788,7 +788,6 @@ void div_decn(void){
//do newton raphson iterations
for (i = 0; i < DEC80_NUM_LSU; i++){ //just fix number of iterations for now
#ifdef DEBUG_DIV
extern char Buf[DECN_BUF_SIZE];
decn_to_str_complete(Buf, &curr_recip);
printf("%2d: %s\n", i, Buf);
#endif
@ -820,18 +819,17 @@ void div_decn(void){
mult_decn();
}
static void set_str_error(char* buf){
buf[0] = 'E';
buf[1] = 'r';
buf[2] = 'r';
buf[3] = 'o';
buf[4] = 'r';
buf[5] = '\0';
static void set_str_error(){
Buf[0] = 'E';
Buf[1] = 'r';
Buf[2] = 'r';
Buf[3] = 'o';
Buf[4] = 'r';
Buf[5] = '\0';
}
//buf should hold at least 18 + 4 + 5 + 1 = 28
int8_t decn_to_str(char* buf, const dec80* x){
#define INSERT_DOT() buf[i++]='.'
int8_t decn_to_str(const dec80* x){
#define INSERT_DOT() Buf[i++]='.'
uint8_t i = 0;
uint8_t digit100;
exp_t exponent = 0;
@ -841,7 +839,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
//handle corner case of NaN
if (decn_is_nan(x)){
set_str_error(buf);
set_str_error();
#ifdef DEBUG
printf (" corner case NaN ");
#endif
@ -856,8 +854,8 @@ int8_t decn_to_str(char* buf, const dec80* x){
#ifdef DEBUG
printf (" corner case, set to 0 ");
#endif
buf[0] = '0';
buf[1] = '\0';
Buf[0] = '0';
Buf[1] = '\0';
return 0;
}
//check sign of number
@ -865,7 +863,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
#ifdef DEBUG
printf (" negative ");
#endif
buf[i] = '-';
Buf[i] = '-';
i++;
}
//check if we should use scientific notation
@ -876,18 +874,18 @@ int8_t decn_to_str(char* buf, const dec80* x){
//pad zeros right of decimal point if needed
if (!use_sci && exponent < 0){
exp_t j;
buf[i] = '0';
Buf[i] = '0';
i++;
INSERT_DOT();
//pad zeros right of decimal point
// for (j = exponent + 1; j < 0; j++){ <--- results in undefined behavior (signed overflow), and causes crash
for (j = -exponent -1; j > 0; --j){
buf[i] = '0';
Buf[i] = '0';
i++;
}
}
//print 1st digit
buf[i] = (tmp.lsu[0] / 10) + '0';
Buf[i] = (tmp.lsu[0] / 10) + '0';
i++;
if (use_sci) {
INSERT_DOT();
@ -898,7 +896,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
exponent--;
}
//print 2nd digit
buf[i] = (tmp.lsu[0] % 10) + '0';
Buf[i] = (tmp.lsu[0] % 10) + '0';
if (tmp.lsu[0] % 10 == 0 && (use_sci || exponent < 0)){
trailing_zeros = 1;
@ -913,7 +911,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
//print rest of significand
for (digit100 = 1 ; digit100 < DEC80_NUM_LSU; digit100++){
//print 1st digit
buf[i] = (tmp.lsu[digit100] / 10) + '0';
Buf[i] = (tmp.lsu[digit100] / 10) + '0';
i++;
if (!use_sci){
if (exponent == 0){
@ -922,7 +920,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
exponent--;
}
//print 2nd digit
buf[i] = (tmp.lsu[digit100] % 10) + '0';
Buf[i] = (tmp.lsu[digit100] % 10) + '0';
i++;
if (!use_sci){
if (exponent == 0){
@ -948,7 +946,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
if (use_sci || exponent <= 0){
i -= trailing_zeros;
}
buf[i] = '\0';
Buf[i] = '\0';
//calculate exponent
exponent = get_exponent(&tmp); //base 100
@ -959,7 +957,7 @@ int8_t decn_to_str(char* buf, const dec80* x){
if (use_sci){
//check for overflow
if (exponent > DEC80_MAX_EXP || exponent < DEC80_MIN_EXP){
set_str_error(buf);
set_str_error();
return 0;
}
return exponent;
@ -978,19 +976,19 @@ int8_t decn_to_str(char* buf, const dec80* x){
#ifdef DESKTOP
//complete string including exponent
void decn_to_str_complete(char* buf, const dec80* x){
int8_t exponent = decn_to_str(buf, x);
void decn_to_str_complete(const dec80* x){
int8_t exponent = decn_to_str(x);
int i;
//find end of string
for (i = 0; buf[i] != '\0'; i++);
for (i = 0; Buf[i] != '\0'; i++);
//add exponent
if (exponent != 0){
buf[i++] = 'E';
Buf[i++] = 'E';
if (exponent < 0){
buf[i++] = '-';
u32str(-exponent, &buf[i], 10); //adds null terminator automatically
Buf[i++] = '-';
u32str(-exponent, &Buf[i], 10); //adds null terminator automatically
} else {
u32str(exponent, &buf[i], 10); //adds null terminator automatically
u32str(exponent, &Buf[i], 10); //adds null terminator automatically
}
}
}

View File

@ -16,7 +16,7 @@ extern "C" {
#define DEC80_NUM_LSU 9
//#define EXP16
#define EXP16
#ifdef EXP16
typedef int16_t exp_t;
@ -53,7 +53,7 @@ exp_t get_exponent(const dec80* x);
void copy_decn(dec80* dest, const dec80* src);
extern __idata dec80 AccDecn, BDecn;
void build_dec80(const char* signif_str, exp_t exponent);
void build_dec80(__xdata const char* signif_str, exp_t exponent);
void set_dec80_zero(dec80* dest);
void set_dec80_NaN(dec80* dest);
@ -64,13 +64,14 @@ void add_decn(void);
void mult_decn(void);
void div_decn(void);
//buf should hold at least 18 + 4 + 5 + 1 = 28
//Buf should hold at least 18 + 4 + 5 + 1 = 28
#define DECN_BUF_SIZE 28
int8_t decn_to_str(char* buf, const dec80* x);
extern __xdata char Buf[DECN_BUF_SIZE];
int8_t decn_to_str(const dec80* x);
#ifdef DESKTOP
//complete string including exponent
void decn_to_str_complete(char* buf, const dec80* x);
void decn_to_str_complete(const dec80* x);
void build_decn_at(dec80* dest, const char* signif_str, exp_t exponent);
#endif

View File

@ -32,17 +32,17 @@ static void div_test(
{
build_dec80(a_str, a_exp);
build_decn_at(&BDecn, b_str, b_exp);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf(" acc: %s\n", Buf);
decn_to_str_complete(Buf, &BDecn);
decn_to_str_complete(&BDecn);
printf(" b: %s\n", Buf);
div_decn();
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("acc/b: %s\n", Buf);
printf(" : %s\n", res_str);
build_decn_at(&diff, res_calc, res_exp);
take_diff();
decn_to_str_complete(Buf, &diff);
decn_to_str_complete(&diff);
printf(" : %s\n\n", Buf);
}
@ -50,15 +50,15 @@ int main(void){
// dec80 acc, b;
build_dec80("0.0009234567890123456", 7);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf(" acc: %s\n", Buf);
build_dec80("9.234567890123456", 3);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf(" acc: %s\n", Buf);
negate_decn(&AccDecn);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("-acc: %s\n", Buf);
dec80 tmp_copy;
@ -66,54 +66,54 @@ int main(void){
build_dec80("-92.3456789012345678", 1);
copy_decn(&BDecn, &AccDecn);
copy_decn(&AccDecn, &tmp_copy); //restore
decn_to_str_complete(Buf, &BDecn);
decn_to_str_complete(&BDecn);
printf(" b: %s\n", Buf);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("-acc: %s\n", Buf);
//compare result of b - acc
add_decn();
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("b - a: %s\n", Buf);
printf(" : %s\n", "-10158.0246791358016");
build_decn_at(&diff, "-1.01580246791358016", 4);
take_diff();
decn_to_str_complete(Buf, &diff);
decn_to_str_complete(&diff);
printf(" : %s\n\n", Buf);
//new acc for acc - b test
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("acc: %s\n", Buf);
negate_decn(&BDecn);
decn_to_str_complete(Buf, &BDecn);
decn_to_str_complete(&BDecn);
printf(" -b: %s\n", Buf);
add_decn();
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
//compare result of new acc - b
printf("acc - b: %s\n", Buf);
printf(" : %s\n", "-9234.567890123456");
build_decn_at(&diff, "-9.234567890123456", 3);
take_diff();
decn_to_str_complete(Buf, &diff);
decn_to_str_complete(&diff);
printf(" : %s\n\n", Buf);
//new acc and b for multiply test
// build_dec80("7", 2);
build_dec80("92.34567890123456", 2);
build_decn_at(&BDecn, "-92.3456789012345678", 1);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf(" acc: %s\n", Buf);
decn_to_str_complete(Buf, &BDecn);
decn_to_str_complete(&BDecn);
printf(" b: %s\n", Buf);
mult_decn();
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("acc*b: %s\n", Buf);
printf(" : %s\n", "-8527724.41172991849");
build_decn_at(&diff, "-8.52772441172991849", 6);
take_diff();
decn_to_str_complete(Buf, &diff);
decn_to_str_complete(&diff);
printf(" : %s\n\n", Buf);
//new acc and b for divide test
@ -143,13 +143,13 @@ int main(void){
//small fractions >= 1/10
build_dec80("0.333", 0);
build_decn_at(&BDecn, "3.33", -1);
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf(" a : %s\n", Buf);
decn_to_str_complete(Buf, &BDecn);
decn_to_str_complete(&BDecn);
printf(" b : %s\n", Buf);
negate_decn(&BDecn);
add_decn();
decn_to_str_complete(Buf, &AccDecn);
decn_to_str_complete(&AccDecn);
printf("a - b: %s\n", Buf);
//new acc and b for divide test

View File

@ -24,10 +24,10 @@ const char state_names[4][32] = {
#define M_COLS 4
uint8_t Keys[TOTAL_ROWS]; //only bottom nibbles get set
__idata uint8_t Keys[TOTAL_ROWS]; //only bottom nibbles get set
int8_t NewKeyPressed; //row*M_COLS + col, see KEY_MAP[] in main.c
static uint8_t last_state[TOTAL_ROWS]; //all used, 2 bits per key
static int8_t last_count[TOTAL_ROWS][M_COLS]; //all used
__idata static uint8_t last_state[TOTAL_ROWS]; //all used, 2 bits per key
__idata static int8_t last_count[TOTAL_ROWS][M_COLS]; //all used
static uint8_t unexpected_count; //count of unexpected transitions
static const int8_t COUNT_LIM_LOW = -30;
@ -52,7 +52,7 @@ void KeyInit(void){
}
}
static void raw_scan(void){
void raw_scan(void){
static uint8_t i = 0;
static const uint8_t data[] = {
0,0,0,0,0,0,0,0,0,0,0,0,
@ -102,7 +102,8 @@ void KeyInit(void){
NewKeyPressed = -1;
}
static void raw_scan(void){
#pragma nooverlay
void raw_scan(void) __using(1){
//top row not part of matrix
static const uint8_t M_ROWS = 4;
uint8_t i, j;
@ -137,7 +138,8 @@ static void raw_scan(void){
//based on quick draw/integrator hybrid debounce algorithm from
//https://summivox.wordpress.com/2016/06/03/keyboard-matrix-scanning-and-debouncing/
static void debounce(void){
#pragma nooverlay
void debounce(void) __using(1){
uint8_t i, j;
NewKeyPressed = -1; //initially
// new_keys_pressed = 0; //initially
@ -226,11 +228,6 @@ static void debounce(void){
}
void KeyScan(void){
raw_scan();
debounce();
}
#ifdef DEBUG_KEYS
const uint8_t* DebugGetKeys(void){
return keys;

View File

@ -12,10 +12,23 @@
extern "C" {
#endif
#include "utils.h"
//#define DEBUG_KEYS
void KeyInit(void);
void KeyScan(void);
#pragma nooverlay
void raw_scan(void) __using(1);
#pragma nooverlay
void debounce(void) __using(1);
#define KeyScan() do { \
raw_scan(); \
debounce(); \
} while(0);
#ifdef DEBUG_KEYS
const uint8_t* DebugGetKeys(void);
@ -24,7 +37,7 @@ const uint8_t* DebugGetKeys(void);
//definition included for determining if multiple keys are pressed
//prefer using GetNewKeys();
#define TOTAL_ROWS 5
extern uint8_t Keys[TOTAL_ROWS]; //only bottom nibbles get set
extern __idata uint8_t Keys[TOTAL_ROWS]; //only bottom nibbles get set
extern int8_t NewKeyPressed;

View File

@ -186,7 +186,7 @@ void LCD_Open(void) {
}
//row and columns indexed from 0
void LCD_GoTo(unsigned int row_to, unsigned int col_to) {
void LCD_GoTo(uint8_t row_to, uint8_t col_to) {
if (row_to < MAX_ROWS && col_to < MAX_CHARS_PER_LINE) {
outCsr(0x80 + 0x40 * row_to + col_to); //set ddram address to position
row = row_to;
@ -205,7 +205,7 @@ static void to_row(unsigned char row_to) {
col = 0;
}
void LCD_OutString(const char *string, uint8_t max_chars) {
void LCD_OutString(__xdata const char *string, uint8_t max_chars) {
const char *s;
for (s = string; *s && max_chars > 0; s++, max_chars--) {
TERMIO_PutChar(*s);

View File

@ -5,14 +5,17 @@
extern "C" {
#endif
#include <stdint.h>
#include "utils.h"
#define MAX_CHARS_PER_LINE 16
#define MAX_ROWS 2
void LCD_Open(void);
void LCD_Clear(void);
void LCD_GoTo(unsigned int row, unsigned int col);
void LCD_GoTo(uint8_t row, uint8_t col);
void LCD_OutString(const char* string, uint8_t max_chars);
void LCD_OutString(__xdata const char* string, uint8_t max_chars);
short TERMIO_PutChar(unsigned char letter);
void LCD_OutNibble(uint8_t x);
void LCD_ClearToEnd(uint8_t curr_row);

View File

@ -46,7 +46,7 @@ void LCD_Clear(void){
lcd_col=0;
}
void LCD_GoTo(unsigned int row, unsigned int col){
void LCD_GoTo(uint8_t row, uint8_t col){
if (row < MAX_ROWS && col < MAX_CHARS_PER_LINE){
lcd_row = row;
lcd_col = col;

View File

@ -39,8 +39,12 @@ volatile uint8_t NewKeyEmpty;
#define INCR_NEW_KEY_I(i) i = (i + 1) & 3
volatile uint8_t SecCount;
//#define TRACK_TIME
#ifdef TRACK_TIME
volatile uint8_t SecCount;
#endif
void timer0_isr() SDCC_ISR(1,1)
{
#ifdef TRACK_TIME
@ -119,9 +123,9 @@ static void latch_on(void)
#endif //!DESKTOP
char Buf[DECN_BUF_SIZE];
__xdata char EntryBuf[MAX_CHARS_PER_LINE + 1];
__xdata uint8_t ExpBuf[2];
__xdata const char VER_STR[32+1] = "STC RPN Calculator v1.03";
#ifdef DESKTOP
static void print_entry_bufs(void){
@ -149,7 +153,6 @@ int main()
};
uint8_t entry_i = 0;
uint8_t entering_exp = ENTERING_DONE;
uint8_t no_lift = 0;
uint8_t exp_i = 0;
int8_t disp_exponent;
NewKeyEmpty = 1; //initially empty
@ -172,7 +175,7 @@ int main()
ExpBuf[0] = 0;
ExpBuf[1] = 0;
LCD_OutString("STC RPN Calculator v1.02", 32);
LCD_OutString(VER_STR, 32);
#ifdef DESKTOP
LcdAvailable.release();
#endif
@ -324,7 +327,7 @@ int main()
exponent = -exponent;
}
EntryBuf[entry_i] = '\0';
push_decn(EntryBuf, exponent, no_lift);
push_decn(EntryBuf, exponent);
process_cmd(KEY_MAP[i_key]);
//reset state as initial ENTERING_DONE state
entering_exp = ENTERING_DONE;
@ -336,14 +339,14 @@ int main()
//dup
process_cmd(KEY_MAP[i_key]);
}
no_lift = 1;
NoLift = 1;
} break;
//////////
case 'c': {
if (entering_exp == ENTERING_DONE){
//clear
clear_x();
no_lift = 1;
NoLift = 1;
entering_exp = ENTERING_SIGNIF;
EntryBuf[entry_i] = '0';
//do not increment entry_i from 0, until first non-0 entry
@ -376,7 +379,7 @@ int main()
exponent = -exponent;
}
EntryBuf[entry_i] = '\0';
push_decn(EntryBuf, exponent, no_lift);
push_decn(EntryBuf, exponent);
process_cmd(KEY_MAP[i_key]);
//reset state as initial ENTERING_DONE state
entering_exp = ENTERING_DONE;
@ -388,7 +391,7 @@ int main()
//process key
process_cmd(KEY_MAP[i_key]);
}
no_lift = 0;
NoLift = 0;
} break;
//////////
default: process_cmd(KEY_MAP[i_key]);
@ -403,10 +406,10 @@ int main()
LCD_GoTo(0,0);
//display y register on first line
if (entering_exp == ENTERING_DONE){
disp_exponent = decn_to_str(Buf, get_y());
disp_exponent = decn_to_str(get_y());
} else {
//display x on 1st line, entered number on 2nd line
disp_exponent = decn_to_str(Buf, get_x());
disp_exponent = decn_to_str(get_x());
}
if (disp_exponent == 0){
LCD_OutString(Buf, MAX_CHARS_PER_LINE);
@ -430,7 +433,7 @@ int main()
print_entry_bufs();
#endif
if (entering_exp == ENTERING_DONE){
disp_exponent = decn_to_str(Buf, get_x());
disp_exponent = decn_to_str(get_x());
if (disp_exponent == 0){
LCD_OutString(Buf, MAX_CHARS_PER_LINE);
} else { //have exponent to display

View File

@ -60,6 +60,7 @@ void backlight_off(void){
#endif //ifdef desktop
#ifdef DESKTOP
char* u32str(uint32_t x, char* buf, uint8_t base)
{
int i = 0, j;
@ -87,4 +88,5 @@ char* u32str(uint32_t x, char* buf, uint8_t base)
return buf;
}
#endif

View File

@ -24,7 +24,6 @@ void _delay_us(uint8_t us);
void backlight_off(void);
char* u32str(uint32_t x, char* buf, uint8_t base);
#ifdef __linux__
@ -36,11 +35,13 @@ char* u32str(uint32_t x, char* buf, uint8_t base);
#endif
#if defined(DESKTOP) || defined(IS_ECLIPSE)
char* u32str(uint32_t x, char* buf, uint8_t base);
#define __xdata
#define __idata
#define __sfr
#define __at uint8_t*
#define SDCC_ISR(isr, reg)
#define __using(x)
#define BACKLIGHT_ON()
#define TURN_OFF()
#else