Skip to content

Commit 0d7e78e

Browse files
AnnsAnnsmguetschowcrasbe
committed
Apply suggestions from code review
Co-authored-by: mguetschow <[email protected]> Co-authored-by: crasbe <[email protected]>
1 parent 468602e commit 0d7e78e

File tree

10 files changed

+37
-24
lines changed

10 files changed

+37
-24
lines changed

boards/rpi-pico-2-arm/include/board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#pragma once
88

99
/**
10-
* @ingroup boards_rpi_pico_2
10+
* @ingroup boards_rpi_pico_2_arm
1111
* @{
1212
*
1313
* @file

cpu/riscv_common/irq_arch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static void __attribute__((interrupt)) trap_entry(void)
247247
"csrr a0, mcause \n"
248248

249249
/* Call trap handler, a0 contains mcause before, and the return value after
250-
* the call */
250+
* the call */
251251
"call handle_trap \n"
252252

253253
/* Load the sched_context_switch_request */
@@ -264,12 +264,12 @@ static void __attribute__((interrupt)) trap_entry(void)
264264

265265
"no_sched: \n"
266266
/* Restore the thread stack pointer and check if a new thread must be
267-
* scheduled */
267+
* scheduled */
268268
"mv sp, s0 \n"
269269

270270
/* No context switch required, shortcut to restore. a0 contains the return
271-
* value of sched_run, or the sched_context_switch_request if the sched_run
272-
* was skipped */
271+
* value of sched_run, or the sched_context_switch_request if the sched_run
272+
* was skipped */
273273
"beqz a0, no_switch \n"
274274

275275
/* Skips the rest of the save if no active thread */

cpu/rp2350_arm/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
MODULE = cpu
33

44
# add a list of subdirectories, that should also be built
5-
DIRS = $(RIOTCPU)/rp2350_common $(RIOTCPU)/cortexm_common
5+
DIRS += $(RIOTCPU)/rp2350_common
6+
DIRS += $(RIOTCPU)/cortexm_common
67

78
include $(RIOTBASE)/Makefile.base

cpu/rp2350_common/include/periph_cpu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ typedef uint32_t gpio_t;
3333
#define _u(x) ((uint32_t)(x))
3434

3535
#ifdef RP2350_USE_RISCV
36-
#include "periph_cpu_common.h"
37-
#include "xh3irq.h"
36+
# include "periph_cpu_common.h"
37+
# include "xh3irq.h"
3838
#endif
3939
#include "cpu.h"
4040
#include "core_cm33.h" /* Trick RP2350 into believing the file exists on RISCV */
@@ -45,11 +45,11 @@ typedef uint32_t gpio_t;
4545
#include "uart_conf.h"
4646

4747
#if !(defined(RP2350_USE_ARM) || defined(RP2350_USE_RISCV))
48-
#error "Either RP2350_USE_ARM or RP2350_USE_RISCV must be defined"
48+
# error "Either RP2350_USE_ARM or RP2350_USE_RISCV must be defined"
4949
#endif
5050

5151
#if (defined(RP2350_USE_ARM) && defined(RP2350_USE_RISCV))
52-
#error "Only one of RP2350_USE_ARM or RP2350_USE_RISCV can be defined"
52+
# error "Only one of RP2350_USE_ARM or RP2350_USE_RISCV can be defined"
5353
#endif
5454

5555
#ifdef __cplusplus

cpu/rp2350_common/periph/uart.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "debug.h"
2626

2727
#ifdef RP2350_USE_RISCV
28-
#include "xh3irq.h"
28+
# include "xh3irq.h"
2929
#endif
3030

3131
#include "board.h"
@@ -42,6 +42,7 @@ void _irq_enable(uart_t uart)
4242
{
4343
UART0_Type *dev = uart_config[uart].dev;
4444
/* We set the UART Receive Interrupt Mask (Bit 4) [See p979 UART 12.1]*/
45+
<<<<<<< HEAD
4546
dev->UARTIMSC = UART_UARTIMSC_RXIM_BITS;
4647
/* Enable the IRQ */
4748
rp_irq_enable(uart_config[uart].irqn);
@@ -69,6 +70,15 @@ void _set_symbolrate(uart_t uart, uint32_t baud)
6970

7071
dev->UARTIBRD = baud_ibrd;
7172
dev->UARTFBRD = baud_fbrd;
73+
=======
74+
dev->UARTIMSC = UART0_UARTIMSC_RXIM_Msk;
75+
/* Enable the IRQ in the NVIC */
76+
#ifdef RP2350_USE_RISCV
77+
xh3irq_enable_irq(uart_config[uart].irqn);
78+
#else
79+
NVIC_EnableIRQ(uart_config[uart].irqn);
80+
#endif
81+
>>>>>>> a64ab76543 (Apply suggestions from code review)
7282
}
7383

7484
int uart_mode(uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity,
@@ -203,7 +213,7 @@ void uart_write(uart_t uart, const uint8_t *data, size_t len)
203213

204214
void uart_poweron(uart_t uart) {
205215
assert((unsigned)uart < UART_NUMOF);
206-
/* Get into a save state where we know whats up */
216+
/* Get into a save state where we know what's up */
207217
_reset_uart(uart);
208218
UART0_Type *dev = uart_config[uart].dev;
209219
/* Restore config from registers */

cpu/rp2350_common/vectors.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
* @author Tom Hert <[email protected]>
1515
*/
1616

17+
#include <stdint.h>
18+
1719
#include "cpu_conf.h"
1820
#include "panic.h"
19-
#include <stdint.h>
2021

2122
#ifdef RP2350_USE_RISCV
22-
#include "xh3irq.h"
23+
# include "xh3irq.h"
2324
#else
24-
#include "vectors_cortexm.h"
25+
# include "vectors_cortexm.h"
2526
#endif
2627

2728
#define WEAK_DEFAULT __attribute__((weak, alias("dummy_handler")))
@@ -91,7 +92,7 @@ WEAK_DEFAULT void isr_spareirq_5(void);
9192
* @see 3.2 Interrupts and IRQn_Type in RP2350.h
9293
*/
9394
#ifdef RP2350_USE_ARM
94-
/* CortexM does some macro magic, RISCV doesnt */
95+
/* CortexM does some macro magic, RISCV does not */
9596
ISR_VECTOR(1)
9697
#endif
9798
const void* vector_cpu[CPU_IRQ_NUMOF] = {

cpu/rp2350_riscv/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
MODULE = cpu
33

44
# add a list of subdirectories, that should also be built
5-
DIRS = $(RIOTCPU)/rp2350_common $(RIOTCPU)/riscv_common
5+
DIRS += $(RIOTCPU)/rp2350_common
6+
DIRS += $(RIOTCPU)/riscv_common
67

78
include $(RIOTBASE)/Makefile.base

cpu/rp2350_riscv/Makefile.features

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
CPU_CORE := rv32imac
1+
CPU_CORE := rv32imac
22
CPU_FAM := RP2350
33
CPU_MODEL = rp2350_hazard3
44

55
FEATURES_PROVIDED += periph_xh3irq
66

77
include $(RIOTCPU)/rp2350_common/Makefile.features
8-
98
include $(RIOTCPU)/riscv_common/Makefile.features

cpu/rp2350_riscv/picobin_block.s

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* SPDX-License-Identifier: LGPL-2.1-only
55
*/
66

7-
/* Picobin block required for the binary */
8-
/* This defines the minimum viable image metadata to be recognized by the RP2350 bootloader */
9-
/* based on RP2350 Chapter 5.9.1 */
7+
/* Picobin block required for the binary.
8+
* This defines the minimum viable image metadata to be recognized by the RP2350 bootloader
9+
* based on RP2350 Chapter 5.9.1
10+
*/
1011

1112
.section .picobin_block, "a" /* "a" means "allocatable" (can be moved by the linker) */
1213

features.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ groups:
284284
- name: cpu_rpx0xx
285285
help: The MCU is part of the Raspberry PI RPx0xx family.
286286
- name: cpu_rp2350_arm
287-
help: The MCU is a Raspberry Pi RP2350 CortexM33 ARMM
287+
help: The MCU is a Raspberry Pi RP2350 Cortex-M33 ARM,
288288
- name: cpu_rp2350_riscv
289-
help: The MCU is a Raspberry Pi RP2350 Hazard3 RISCV
289+
help: The MCU is a Raspberry Pi RP2350 Hazard3 RISC-V.
290290

291291
- title: Silicon Laboratories EFM32 Grouping
292292
features:

0 commit comments

Comments
 (0)