Skip to content

cpu/mips32r2_common: Added call to stdio_init()#12227

Merged
benpicco merged 1 commit intoRIOT-OS:masterfrom
maribu:mips32r2-early-stdio
Sep 17, 2019
Merged

cpu/mips32r2_common: Added call to stdio_init()#12227
benpicco merged 1 commit intoRIOT-OS:masterfrom
maribu:mips32r2-early-stdio

Conversation

@maribu
Copy link
Member

@maribu maribu commented Sep 14, 2019

Contribution description

Added a call to stdio_init() right before calling `periph_init().

Testing procedure

Flash and run e.g. examples/default or examples/hello-world and see if stdio is working again

Issues/PRs references

Fixes bug introduced in #11367

@maribu maribu requested a review from kaspar030 September 14, 2019 09:40
@maribu maribu added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: MIPS Platform: This PR/issue effects MIPS-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Sep 14, 2019
@maribu
Copy link
Member Author

maribu commented Sep 14, 2019

As I do not have the hardware, this is completely untested. Maybe @francois-berder can test it?

@maribu maribu force-pushed the mips32r2-early-stdio branch from 9f0620b to 5fd6652 Compare September 14, 2019 09:42
@maribu
Copy link
Member Author

maribu commented Sep 14, 2019

I fixed a typo in the commit message right away

@maribu maribu changed the title cpu/mips32_r2_common: Added call to stdio_init() cpu/mips32r2_common: Added call to stdio_init() Sep 14, 2019
@benpicco benpicco added this to the Release 2019.10 milestone Sep 15, 2019
@francois-berder
Copy link
Contributor

Hello,

I compiled hello-world and ran it on pic32-wifire. The bug you mentioned was actually not present on pic32 boards because uart_init is called from cpu_init so uart would get initialized. I had to make additional changes (see the diff below), but I think that is outside the scope of this PR. So ACK !

diff --git a/boards/pic32-wifire/include/board.h b/boards/pic32-wifire/include/board.h
index 2a4542408..251071585 100644
--- a/boards/pic32-wifire/include/board.h
+++ b/boards/pic32-wifire/include/board.h
@@ -81,6 +81,12 @@ extern "C" {
  */
 void board_init(void);
 
+
+/**
+ * @brief   Use the 2nd UART for STDIO on this board
+ */
+#define STDIO_UART_DEV      UART_DEV(4)
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/boards/pic32-wifire/wifire.c b/boards/pic32-wifire/wifire.c
index 9fe3b221a..3e12bbfbf 100644
--- a/boards/pic32-wifire/wifire.c
+++ b/boards/pic32-wifire/wifire.c
@@ -28,11 +28,6 @@ void board_init(void)
     U4RXR =   0xb;            /* connect pin RPF2 to UART 4 RX */
     RPF8R =   0x2;            /* connect pin RPF8 to UART 4 TX */
 
-    /* intialise UART used for debug (printf) */
-#ifdef DEBUG_VIA_UART
-    uart_init(DEBUG_VIA_UART, DEBUG_UART_BAUD, NULL, 0);
-#endif
-
     /* Turn off all LED's */
     gpio_init(LED1_PIN, GPIO_OUT);
     gpio_init(LED2_PIN, GPIO_OUT);
diff --git a/cpu/mips32r2_common/thread_arch.c b/cpu/mips32r2_common/thread_arch.c
index 4fae163d8..44c3f1c4f 100644
--- a/cpu/mips32r2_common/thread_arch.c
+++ b/cpu/mips32r2_common/thread_arch.c
@@ -182,12 +182,8 @@ mem_rw(const void *vaddr)
 extern int _dsp_save(struct dspctx *ctx);
 extern int _dsp_load(struct dspctx *ctx);
 #endif
-/*
- * The nomips16 attribute should not really be needed, it works around a toolchain
- * issue in 2016.05-03.
- */
-void __attribute__((nomips16))
-_mips_handle_exception(struct gpctx *ctx, int exception)
+
+void _mips_handle_exception(struct gpctx *ctx, int exception)
 {
     unsigned int syscall_num = 0;
 #ifdef MIPS_DSP

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by @francois-berder

Same change as on the others archs.

@benpicco benpicco merged commit 5a01a76 into RIOT-OS:master Sep 17, 2019
@kaspar030
Copy link
Contributor

This PR actually broke the pic32-wifire for me, hard-faults directly after boot. Uncommenting the "stdio_init()" line makes it work again.

@benpicco
Copy link
Contributor

@kaspar030 can you try with #12256

@maribu maribu deleted the mips32r2-early-stdio branch May 11, 2020 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: MIPS Platform: This PR/issue effects MIPS-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants