-
Notifications
You must be signed in to change notification settings - Fork 10
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
Serial_HelloWorld example does not work when compiled with SDCC4.4.0 #13
Comments
yes i had similar issue
instead of |
i found the actual place that needs to be modified is util.h
|
Thank you for looking into this! Strangely enough, I also had issues where no error occured, but this example still would not work. |
diff --git a/Serial_HelloWorld/Makefile b/Serial_HelloWorld/Makefile
index 920f9e9..f025148 100644
--- a/Serial_HelloWorld/Makefile
+++ b/Serial_HelloWorld/Makefile
@@ -1,5 +1,5 @@
-DEVICE = PFS154
+DEVICE = PFS173
F_CPU = 8000000
TARGET_VDD_MV = 4000
TARGET_VDD = 4.0
diff --git a/SleepWake/Makefile b/SleepWake/Makefile
index 49bf6ee..531d2e6 100644
--- a/SleepWake/Makefile
+++ b/SleepWake/Makefile
@@ -1,6 +1,6 @@
-DEVICE = PFS154
-F_CPU = 70000
+DEVICE = PFS173
+F_CPU = 8000000
TARGET_VDD_MV = 4000
TARGET_VDD = 4.0
@@ -20,7 +20,7 @@ SOURCES = main.c
OBJECTS = $(patsubst %.c,$(BUILD_DIR)/%.rel,$(SOURCES))
# http://sdcc.sourceforge.net/doc/sdccman.pdf
-COMPILE = sdcc -m$(ARCH) -c --std-sdcc11 --opt-code-size -D$(DEVICE) -DF_CPU=$(F_CPU) -DTARGET_VDD_MV=$(TARGET_VDD_MV) -I. -I$(ROOT_DIR)/include
+COMPILE = sdcc -m$(ARCH) -c --std-sdcc11 --opt-code-size --fverbose-asm -D$(DEVICE) -DF_CPU=$(F_CPU) -DTARGET_VDD_MV=$(TARGET_VDD_MV) -I. -I$(ROOT_DIR)/include
LINK = sdcc -m$(ARCH)
EASYPDKPROG = easypdkprog
diff --git a/SleepWake/main.c b/SleepWake/main.c
index a07ddd9..1ae9963 100644
--- a/SleepWake/main.c
+++ b/SleepWake/main.c
@@ -43,7 +43,8 @@ void main(void) {
setup();
// Main processing loop
- while (1) {
+ while (1)
+ {
for (int i = 0; i < 3; i++) {
turnLedOn();
_delay_ms(400);
@@ -51,7 +52,7 @@ void main(void) {
_delay_ms(400);
}
- sleep();
+ //sleep();
}
}
diff --git a/include/delay.h b/include/delay.h
index d189df9..d577a37 100644
--- a/include/delay.h
+++ b/include/delay.h
@@ -59,7 +59,7 @@ __asm
subc __delay_loop_16_PARM_1+1 ; 1 cycle
mov a, __delay_loop_16_PARM_1+0 ; 1 cycle
or a, __delay_loop_16_PARM_1+1 ; 1 cycle
- t1sn f, z ; 1 cycle + 1 cycle for final skip
+ t1sn.io f, z ; 1 cycle + 1 cycle for final skip
goto 00001$ ; 2 cycles
// ret ; 2 cycles
__endasm;
@@ -88,7 +88,7 @@ __asm
or a, __delay_loop_32_PARM_1+1 ; 1 cycle
or a, __delay_loop_32_PARM_1+2 ; 1 cycle
or a, __delay_loop_32_PARM_1+3 ; 1 cycle
- t1sn f, z ; 1 cycle + 1 cycle for final skip
+ t1sn.io f, z ; 1 cycle + 1 cycle for final skip
goto 00001$ ; 2 cycles
// ret ; 2 cycles
__endasm;
diff --git a/include/pdk/util.h b/include/pdk/util.h
index 0838541..7b5563d 100644
--- a/include/pdk/util.h
+++ b/include/pdk/util.h
@@ -29,9 +29,10 @@
//macros so we can use defines in assembler strings
#define _STRINGIFY(x) #x
-#define _STR(x) _STRINGIFY(x)
#define _STR_VAR(x) "_"_STRINGIFY(x)
+#define _STR(x) _STRINGIFY(x)
#define _VAR(x) _ ## x
+#define _ASMS(x) VAR(x)
//definitions for built in opcodes
#define __nop() __asm__("nop\n")
@@ -41,8 +42,8 @@
#define __stopexe() __asm__("stopexe\nnop\n")
#define __reset() __asm__("reset\n")
#define __wdreset() __asm__("wdreset\n")
-#define __set0(var,bit) __asm__("set0 "_STR_VAR(var)", #"_STR(bit)"\n")
-#define __set1(var,bit) __asm__("set1 "_STR_VAR(var)", #"_STR(bit)"\n")
+#define __set0io(x,y) __asm__("set0.io "_STR_VAR(x)", #"_STR(y)"\n")
+#define __set1io(x,y) __asm__("set1.io "_STR_VAR(x)", #"_STR(y)"\n")
// BIT definitions
#define BIT0 (1)
diff --git a/include/serial.h b/include/serial.h
index 913d32f..16b7eeb 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -23,9 +23,9 @@ void serial_setup() {
void serial_irq_handler() {
if (txdata) { // Does txdata contains bits to send?
if (txdata & 0x01) // Check bit (1/0) for sending
- __set1(PA, SERIAL_TX_PIN); // Send 1 on TX Pin
+ __set1io(PA, 7); // Send 1 on TX Pin
else
- __set0(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
+ __set0io(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
txdata >>= 1; // Shift txdata
}
}
|
Nice, thank you! Would you be willing to provide your diff as a pull request? |
done. |
Can you check if this issue is fixed for you now? |
@spth , @serisman
It appears there is something broken in SDCC4.4.0
The Serial_HelloWorld example compiles&programs without warnings, but when I run it, there is no output from the serial monitor.
When doing the same with SDCC4.1.0 everything works fine.
I have similar issues with my old code that I cannot get to work with SDCC4.4.0.
Apart from this "silent bug", SDCC4.4.0 also broke compatibility when assembling instructions like
t1sn f,z
, which now have to be renamed tot1sn.io f,z
. All in all a very frustrating experience. If one of you has an idea how to fix it, that would be great! Otherwise I suggest adding recommendations to stick with SDCC4.1.0 to the project.The text was updated successfully, but these errors were encountered: