diff --git a/.idea/cmake.xml b/.idea/cmake.xml
index e4a08eaa6..ebc6a0570 100644
--- a/.idea/cmake.xml
+++ b/.idea/cmake.xml
@@ -75,7 +75,7 @@
-
+
diff --git a/examples/build_system/make/rules.mk b/examples/build_system/make/rules.mk
index b02665cdd..78fce49d2 100644
--- a/examples/build_system/make/rules.mk
+++ b/examples/build_system/make/rules.mk
@@ -9,19 +9,6 @@
# ESP32-Sx and RP2040 has its own CMake build system
ifeq (,$(findstring $(FAMILY),espressif rp2040))
-# ---------------------------------------
-# Compiler Flags
-# ---------------------------------------
-
-CFLAGS += $(addprefix -I,$(INC))
-
-# Verbose mode
-ifeq ("$(V)","1")
-$(info CFLAGS $(CFLAGS) ) $(info )
-$(info LDFLAGS $(LDFLAGS)) $(info )
-$(info ASFLAGS $(ASFLAGS)) $(info )
-endif
-
# ---------------------------------------
# Rules
# ---------------------------------------
@@ -39,6 +26,19 @@ vpath %.S . $(TOP)
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN)_rules.mk
+# ---------------------------------------
+# Compiler Flags
+# ---------------------------------------
+
+CFLAGS += $(addprefix -I,$(INC))
+
+# Verbose mode
+ifeq ("$(V)","1")
+$(info CFLAGS $(CFLAGS) ) $(info )
+$(info LDFLAGS $(LDFLAGS)) $(info )
+$(info ASFLAGS $(ASFLAGS)) $(info )
+endif
+
OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): | $(OBJ_DIRS)
diff --git a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c
index 032dac810..66a319541 100644
--- a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c
+++ b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c
@@ -249,9 +249,10 @@ void board_init(void)
EN(SCI5, TEI5) = 1;
/* Enable USB0 */
+ unsigned short oldPRCR = SYSTEM.PRCR.WORD;
SYSTEM.PRCR.WORD = SYSTEM_PRCR_PRKEY | SYSTEM_PRCR_PRC1;
MSTP(USB0) = 0;
- SYSTEM.PRCR.WORD = SYSTEM_PRCR_PRKEY;
+ SYSTEM.PRCR.WORD = SYSTEM_PRCR_PRKEY | oldPRCR;
/* setup USBI0 interrupt. */
IR(USB0, USBI0) = 0;
@@ -277,6 +278,7 @@ int board_uart_read(uint8_t* buf, int len)
sci_buf[1].buf = buf;
sci_buf[1].cnt = len;
SCI5.SCR.BYTE |= SCI_SCR_RE | SCI_SCR_RIE;
+ // TODO change to non blocking, return -1 immediately if no data
while (SCI5.SCR.BIT.RE) ;
return len - sci_buf[1].cnt;
}