Skip to content

Commit 5e5e91c

Browse files
committed
Since the mbed UART initialisation routines overwrite all of our settings we need to reinit the UART with our parameters if we want to use it for debugging.
1 parent 7bf937d commit 5e5e91c

File tree

8 files changed

+66
-653
lines changed

8 files changed

+66
-653
lines changed

cores/arduino/mbed/mbed.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#define MBED_H
1818

1919
#include "platform/mbed_version.h"
20-
#include "mbed_config.h"
2120

2221
#if MBED_CONF_RTOS_API_PRESENT
2322
#include "rtos/rtos.h"
@@ -64,7 +63,7 @@
6463
#include "drivers/AnalogOut.h"
6564
#include "drivers/PwmOut.h"
6665
#include "drivers/Serial.h"
67-
#include "drivers/SPIMaster.h"
66+
#include "drivers/SPI.h"
6867
#include "drivers/SPISlave.h"
6968
#include "drivers/I2C.h"
7069
#include "drivers/I2CSlave.h"

libraries/MRI/examples/MRI/MRI.ino

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/* This example demonstrates how to include the MRI library which
2-
allows to debug the Nano 33 BLE Cortex-M4 core with GDB via a
2+
allows to debug the Portenta H7 Cortex-M7 core with GDB via a
33
serial interface.
44
*/
55

66
#include <MRI.h>
77

88
void setup() {
9-
9+
Serial1.begin(115200); /* Initialize Serial1 via mbed ... should actually be done within MRI library to have the configuration we need */
10+
__mriInit(0);
1011
}
1112

1213
void loop() {

libraries/MRI/src/architectures/armv7-m/armv7-m_asm.S

+20-20
Original file line numberDiff line numberDiff line change
@@ -359,44 +359,44 @@ mriClearFaultStatusBitsAndReturn:
359359
bx lr
360360

361361

362-
.global HardFault_Handler
363-
.type HardFault_Handler, function
364-
.thumb_func
362+
// .global HardFault_Handler
363+
// .type HardFault_Handler, function
364+
// .thumb_func
365365
/* extern "C" void HardFault_Handler(void);
366366
Override Hard Faults and send to MriExceptionHandler.
367367
*/
368-
HardFault_Handler:
369-
b mriFaultHandler
368+
//HardFault_Handler:
369+
// b mriFaultHandler
370370
371371
372-
.global MemManage_Handler
373-
.type MemManage_Handler, function
374-
.thumb_func
372+
// .global MemManage_Handler
373+
// .type MemManage_Handler, function
374+
// .thumb_func
375375
/* extern "C" void MemManage_Handler(void);
376376
Override MPU Memory Faults and send to MriExceptionHandler.
377377
*/
378-
MemManage_Handler:
379-
b mriFaultHandler
378+
//MemManage_Handler:
379+
// b mriFaultHandler
380380
381381

382-
.global BusFault_Handler
383-
.type BusFault_Handler, function
384-
.thumb_func
382+
// .global BusFault_Handler
383+
// .type BusFault_Handler, function
384+
// .thumb_func
385385
/* extern "C" void BusFault_Handler(void);
386386
Override Bus Faults and send to MriExceptionHandler.
387387
*/
388-
BusFault_Handler:
389-
b mriFaultHandler
388+
//BusFault_Handler:
389+
// b mriFaultHandler
390390
391391

392-
.global UsageFault_Handler
393-
.type UsageFault_Handler, function
394-
.thumb_func
392+
// .global UsageFault_Handler
393+
// .type UsageFault_Handler, function
394+
// .thumb_func
395395
/* extern "C" void UsageFault_Handler(void);
396396
Override Instruction Usage Faults and send to MriExceptionHandler.
397397
*/
398-
UsageFault_Handler:
399-
b __mriExceptionHandler
398+
//UsageFault_Handler:
399+
// b __mriExceptionHandler
400400
401401

402402
.global DebugMon_Handler

libraries/MRI/src/devices/stm32f429xx/stm32f429xx_asm.S

-53
This file was deleted.

libraries/MRI/src/devices/stm32f429xx/stm32f429xx_init.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "../../architectures/armv7-m/armv7-m.h"
2121
#include "../../architectures/armv7-m/debug_cm3.h"
2222

23-
23+
/* Attention - This memory map is still from STM32F429 and NOT FROM STM32H747XI */
2424
static const char g_memoryMapXml[] = "<?xml version=\"1.0\"?>"
2525
"<!DOCTYPE memory-map PUBLIC \"+//IDN gnu.org//DTD GDB Memory Map V1.0//EN\" \"http://sourceware.org/gdb/gdb-memory-map.dtd\">"
2626
"<memory-map>"
@@ -34,20 +34,11 @@ static const char g_memoryMapXml[] = "<?xml version=\"1.0\"?>"
3434
"<memory type=\"ram\" start=\"0x2001C000\" length=\"0x4000\"> </memory>"
3535
"<memory type=\"ram\" start=\"0x20020000\" length=\"0x10000\"> </memory>"
3636
"</memory-map>";
37-
//Stm32f429xxState __mriStm32f429xxState;
38-
39-
40-
/* Reference this handler in the ASM module to make sure that it gets linked in. */
41-
void USART1_IRQHandler(void);
4237

4338

4439
static void defaultExternalInterruptsToPriority1(void);
4540
void __mriStm32f429xx_Init(Token* pParameterTokens)
4641
{
47-
/* Reference handler in ASM module to make sure that is gets linked in. */
48-
void (* volatile dummyReference)(void) = USART1_IRQHandler;
49-
(void)dummyReference;
50-
5142
__try
5243
__mriCortexMInit(pParameterTokens);
5344
__catch

libraries/MRI/src/devices/stm32f429xx/stm32f429xx_init.h

-15
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@
2121
#include "core/token.h"
2222
#include "stm32f429xx_usart.h"
2323

24-
/* Flags that can be set in Stm32f429xxState::flags */
25-
#define STM32F429XX_UART_FLAGS_SHARE 1
26-
#define STM32F429XX_UART_FLAGS_MANUAL_BAUD 2
27-
28-
/* Flag to indicate whether context will contain FPU registers or not. */
29-
#define MRI_DEVICE_HAS_FPU 1
30-
31-
// typedef struct
32-
// {
33-
// const UartConfiguration* pCurrentUart;
34-
// uint32_t flags;
35-
// } Stm32f429xxState;
36-
37-
// extern Stm32f429xxState __mriStm32f429xxState;
38-
3924
void __mriStm32f429xx_Init(Token* pParameterTokens);
4025

4126
#endif /* _STM32F429XX_H_ */

0 commit comments

Comments
 (0)