Skip to content

Commit 750e51d

Browse files
committed
Add Portenta X8
1 parent 6c3abc9 commit 750e51d

9 files changed

+1416
-2
lines changed

boards.txt

+51
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,57 @@ envie_m4.bootloader.file=PORTENTA_H7/portentah7_bootloader_mbed_hs_v2.elf
209209

210210
##############################################################
211211

212+
portenta_x8.name=Arduino Portenta X8
213+
portenta_x8.build.core=arduino
214+
portenta_x8.build.crossprefix=arm-none-eabi-
215+
portenta_x8.build.compiler_path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
216+
217+
portenta_x8.build.variant=PORTENTA_X8
218+
portenta_x8.build.mcu=cortex-m4
219+
portenta_x8.build.fpu=-mfpu=fpv4-sp-d16
220+
portenta_x8.build.float-abi=-mfloat-abi=softfp
221+
portenta_x8.build.extra_flags=
222+
portenta_x8.build.extra_ldflags=-DCM4_BINARY_START=0x08100000 -DCM4_BINARY_END=0x08200000
223+
portenta_x8.build.architecture=cortex-m4
224+
portenta_x8.build.board=PORTENTA_X8
225+
portenta_x8.build.ldscript=linker_script.ld
226+
portenta_x8.compiler.mbed.arch.define=
227+
portenta_x8.compiler.mbed.defines={build.variant.path}/defines.txt
228+
portenta_x8.compiler.mbed.ldflags={build.variant.path}/ldflags.txt
229+
portenta_x8.compiler.mbed.cflags={build.variant.path}/cflags.txt
230+
portenta_x8.compiler.mbed.cxxflags={build.variant.path}/cxxflags.txt
231+
portenta_x8.compiler.mbed.includes={build.variant.path}/includes.txt
232+
portenta_x8.compiler.mbed.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
233+
portenta_x8.compiler.mbed="{build.variant.path}/libs/libmbed.a"
234+
portenta_x8.vid.0=0x2341
235+
portenta_x8.pid.0=0x0061
236+
portenta_x8.build.vid=0x2341
237+
portenta_x8.build.pid=0x0061
238+
portenta_x8.upload_port.0.vid=0x2341
239+
portenta_x8.upload_port.0.pid=0x0061
240+
241+
portenta_x8.upload.tool=adb
242+
portenta_x8.upload.tool.default=adb
243+
portenta_x8.upload.vid=0x2341
244+
portenta_x8.upload.pid=0x0061
245+
portenta_x8.upload.protocol=
246+
portenta_x8.upload.transport=
247+
portenta_x8.upload.interface=0
248+
portenta_x8.upload.use_1200bps_touch=false
249+
portenta_x8.upload.wait_for_upload_port=false
250+
portenta_x8.upload.native_usb=true
251+
portenta_x8.upload.maximum_data_size=294248
252+
253+
portenta_x8.debug.tool=gdb
254+
portenta_x8.bootloader.tool=openocd
255+
portenta_x8.bootloader.tool.default=openocd
256+
portenta_x8.bootloader.config=-f target/stm32h7x_dual_bank.cfg
257+
portenta_x8.bootloader.programmer=-f interface/stlink.cfg
258+
portenta_x8.bootloader.extra_action.preflash=stm32h7x option_write 0 0x01c 0xb86aaf0
259+
portenta_x8.bootloader.file=PORTENTA_X7/STM32H747AII6_CM7.elf
260+
261+
##############################################################
262+
212263
nano33ble.name=Arduino Nano 33 BLE
213264
nano33ble.build.core=arduino
214265
nano33ble.build.crossprefix=arm-none-eabi-

patches/0100-Add-Portenta-X8-target.patch

+1,046
Large diffs are not rendered by default.

platform.txt

+10
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ tools.imgtool.path={runtime.tools.imgtool.path}
195195
tools.imgtool.cmd=imgtool
196196
tools.imgtool.flags=sign --key "{build.keys.keychain}/{build.keys.sign_key}" --encrypt "{build.keys.keychain}/{build.keys.encrypt_key}" "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.bin" --align {build.alignment} --max-align {build.alignment} --version {build.version} --header-size {build.header_size} --pad-header --slot-size {build.slot_size}
197197

198+
#
199+
# ADB WRAPPER
200+
#
201+
202+
tools.adb.path={runtime.tools.adb.path}
203+
tools.adb.cmd=adb-wrapper
204+
tools.adb.upload.params.verbose=-v
205+
tools.adb.upload.params.quiet=
206+
tools.adb.upload.pattern="{path}/{cmd}" flash "{build.path}/{build.project_name}.bin"
207+
198208
#
199209
# GDB (Debugger)
200210
#

portenta.variables

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export FLAVOUR="portenta"
2-
export VARIANTS=("PORTENTA_H7_M7 PORTENTA_H7_M4")
3-
export FQBNS=("envie_m7 envie_m4")
2+
export VARIANTS=("PORTENTA_H7_M7 PORTENTA_H7_M4 PORTENTA_X8")
3+
export FQBNS=("envie_m7 envie_m4 portenta_x8")
44
export LIBRARIES=("doom Ethernet MRI Portenta_SDRAM SPI WiFi ea_malloc openamp_arduino STM32H747_System ThreadDebug Himax_HM01B0 PDM Portenta_Video USBAudio KernelDebug Portenta_Audio RPC USBHID Wire Portenta_lvgl Camera rpclib USBHOST mbed-memory-status Portenta_SDCARD Scheduler USBMSD SocketWrapper GSM GPS MCUboot")
55
export BOOTLOADERS=("PORTENTA_H7")

variants/PORTENTA_X8/conf/.mbedignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mbed-os/connectivity/nanostack/*
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"target_overrides": {
3+
"*": {
4+
"target.printf_lib": "std",
5+
"platform.stdio-buffered-serial": false,
6+
"platform.stdio-baud-rate": 115200,
7+
"platform.default-serial-baud-rate": 115200,
8+
"platform.callback-nontrivial": true,
9+
"platform.all-stats-enabled": true,
10+
"platform.memory-tracing-enabled": true,
11+
"rtos.main-thread-stack-size": 32768,
12+
"target.mbed_app_start": "0x8100000",
13+
"target.macros_add": [
14+
"NO_VTOR_RELOCATE",
15+
"METAL_INTERNAL",
16+
"VIRTIO_SLAVE_ONLY",
17+
"NO_ATOMIC_64_SUPPORT",
18+
"METAL_MAX_DEVICE_REGIONS=2",
19+
"RPMSG_BUFFER_SIZE=2048"
20+
]
21+
}
22+
}
23+
}
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
/* Define mock symbols to nullify PinMode definitions */
3+
#define PullNone TempPullNone
4+
#define PullUp TempPullUp
5+
#define PullDown TempPullDown
6+
#define OpenDrainPullUp TempOpenDrainPullUp
7+
#define OpenDrainNoPull TempOpenDrainNoPull
8+
#define OpenDrainPullDown TempOpenDrainPullDown
9+
#define PushPullNoPull TempPushPullNoPull
10+
#define PushPullPullUp TempPushPullPullUp
11+
#define PushPullPullDown TempPushPullPullDown
12+
#define OpenDrain TempOpenDrain
13+
#define PullDefault TempPullDefault
14+
15+
#define INPUT TempINPUT
16+
#define OUTPUT TempOUTPUT
17+
#define INPUT_PULLUP TempINPUT_PULLUP
18+
#define INPUT_PULLDOWN TempINPUT_PULLDOWN
19+
20+
/* Rename symbol PinMode into MbedPinMode for all the file PinNamesTypes.h
21+
* Functions using PinMode should be redeclared with the correct PinMode symbol */
22+
#define PinMode MbedPinMode
23+
#include "mbed_config.h"
24+
#include "PinNamesTypes.h"
25+
#undef PinMode
26+
27+
/* Rename symbol PinMode into ArduinoPinMode for all the file Common.h
28+
* Functions using PinMode should be redeclared with the correct PinMode symbol */
29+
#define PinMode ArduinoPinMode
30+
#include "api/Common.h"
31+
#undef PinMode
32+
33+
#undef PullNone
34+
#undef PullUp
35+
#undef PullDown
36+
#undef OpenDrainPullUp
37+
#undef OpenDrainNoPull
38+
#undef OpenDrainPullDown
39+
#undef PushPullNoPull
40+
#undef PushPullPullUp
41+
#undef PushPullPullDown
42+
#undef OpenDrain
43+
#undef PullDefault
44+
45+
#undef INPUT
46+
#undef OUTPUT
47+
#undef INPUT_PULLUP
48+
#undef INPUT_PULLDOWN
49+
50+
/* Define the PinName symbol to be used in all the contexts */
51+
typedef enum {
52+
PullNone = TempPullNone,
53+
PullUp = TempPullUp,
54+
PullDown = TempPullDown,
55+
OpenDrainPullUp = TempOpenDrainPullUp,
56+
OpenDrainNoPull = TempOpenDrainNoPull,
57+
OpenDrainPullDown = TempOpenDrainPullDown,
58+
PushPullNoPull = TempPushPullNoPull,
59+
PushPullPullUp = TempPushPullPullUp,
60+
PushPullPullDown = TempPushPullPullDown,
61+
OpenDrain = TempOpenDrain,
62+
PullDefault = TempPullDefault,
63+
INPUT = TempINPUT,
64+
OUTPUT = TempOUTPUT,
65+
INPUT_PULLUP = TempINPUT_PULLUP,
66+
INPUT_PULLDOWN = TempINPUT_PULLDOWN
67+
} PinMode;
68+
69+
#if defined(__cplusplus)
70+
71+
/* Redeclare Common.h functions with the updated PinMode */
72+
void pinMode(pin_size_t pinNumber, PinMode pinMode);
73+
74+
#endif

variants/PORTENTA_X8/pins_arduino.h

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#pragma once
2+
#include <macros.h>
3+
#include "PeripheralPins.h"
4+
5+
#ifndef __PINS_ARDUINO__
6+
#define __PINS_ARDUINO__
7+
8+
#ifdef __cplusplus
9+
extern "C" unsigned int PINCOUNT_fn();
10+
extern "C" bool isBetaBoard();
11+
#endif
12+
13+
// Booting
14+
// ----
15+
void bootM4();
16+
17+
extern PinName digitalPinToPinName(pin_size_t P);
18+
19+
// Pin count
20+
// ----
21+
#define PINS_COUNT (PINCOUNT_fn())
22+
#define NUM_DIGITAL_PINS (36u)
23+
#define NUM_ANALOG_INPUTS (8u)
24+
#define NUM_ANALOG_OUTPUTS (1u)
25+
26+
// LEDs
27+
// ----
28+
#define PIN_LED (33u)
29+
#define LED_BUILTIN PIN_LED
30+
31+
// Analog pins
32+
// -----------
33+
#define PIN_A0 (7u)
34+
#define PIN_A1 (8u)
35+
#define PIN_A2 (9u)
36+
#define PIN_A3 (10u)
37+
#define PIN_A4 (11u)
38+
#define PIN_A5 (12u)
39+
#define PIN_A6 (13u)
40+
#define PIN_A7 (14u)
41+
42+
static const uint8_t A0 = PIN_A0;
43+
static const uint8_t A1 = PIN_A1;
44+
static const uint8_t A2 = PIN_A2;
45+
static const uint8_t A3 = PIN_A3;
46+
static const uint8_t A4 = PIN_A4;
47+
static const uint8_t A5 = PIN_A5;
48+
static const uint8_t A6 = PIN_A6;
49+
static const uint8_t A7 = PIN_A7;
50+
#define ADC_RESOLUTION 12
51+
52+
// Digital pins
53+
// -----------
54+
#define D0 (0u)
55+
#define D1 (1u)
56+
#define D2 (2u)
57+
#define D3 (3u)
58+
#define D4 (4u)
59+
#define D5 (5u)
60+
#define D6 (6u)
61+
#define D7 (7u)
62+
#define D8 (8u)
63+
#define D9 (9u)
64+
#define D10 (10u)
65+
#define D11 (11u)
66+
#define D12 (12u)
67+
#define D13 (13u)
68+
#define D14 (14u)
69+
#define D15 (15u)
70+
#define D16 (16u)
71+
#define D17 (17u)
72+
#define D18 (18u)
73+
#define D19 (19u)
74+
#define D20 (20u)
75+
#define D21 (21u)
76+
77+
//DACs
78+
#define DAC (A6)
79+
80+
// Serial
81+
#define PIN_SERIAL_RX (22ul)
82+
#define PIN_SERIAL_TX (21ul)
83+
84+
#define SERIAL_HOWMANY 1
85+
#define SERIAL1_TX (digitalPinToPinName(PIN_SERIAL_TX))
86+
#define SERIAL1_RX (digitalPinToPinName(PIN_SERIAL_RX))
87+
88+
// SPI
89+
#define PIN_SPI_MISO (10u)
90+
#define PIN_SPI_MOSI (8u)
91+
#define PIN_SPI_SCK (9u)
92+
#define PIN_SPI_SS (7u)
93+
94+
static const uint8_t SS = PIN_SPI_SS; // SPI Slave SS not used. Set here only for reference.
95+
static const uint8_t MOSI = PIN_SPI_MOSI;
96+
static const uint8_t MISO = PIN_SPI_MISO;
97+
static const uint8_t SCK = PIN_SPI_SCK;
98+
99+
// Wire
100+
#define PIN_WIRE_SDA (11u)
101+
#define PIN_WIRE_SCL (12u)
102+
103+
//#define SERIAL_CDC 0
104+
#define HAS_UNIQUE_ISERIAL_DESCRIPTOR
105+
#define BOARD_VENDORID 0x2341
106+
#define BOARD_PRODUCTID 0x0061
107+
#define BOARD_NAME "Portenta X8"
108+
109+
#define DFU_MAGIC_SERIAL_ONLY_RESET 0xb0
110+
111+
uint8_t getUniqueSerialNumber(uint8_t* name);
112+
void _ontouch1200bps_();
113+
114+
#define WIRE_HOWMANY 0
115+
116+
#define I2C_SDA (digitalPinToPinName(PIN_WIRE_SDA))
117+
#define I2C_SCL (digitalPinToPinName(PIN_WIRE_SCL))
118+
119+
#define I2C_SDA_INTERNAL (PB_7)
120+
#define I2C_SCL_INTERNAL (PB_6)
121+
#define I2C_SDA1 I2C_SDA_INTERNAL
122+
#define I2C_SCL1 I2C_SCL_INTERNAL
123+
124+
#define SPI_HOWMANY 0
125+
126+
#define SPI_MISO (digitalPinToPinName(PIN_SPI_MISO))
127+
#define SPI_MOSI (digitalPinToPinName(PIN_SPI_MOSI))
128+
#define SPI_SCK (digitalPinToPinName(PIN_SPI_SCK))
129+
130+
#define digitalPinToPort(P) (digitalPinToPinName(P)/32)
131+
132+
#define SERIAL_PORT_USBVIRTUAL Serial
133+
#define SERIAL_PORT_MONITOR Serial
134+
#define SERIAL_PORT_HARDWARE Serial1
135+
#define SERIAL_PORT_HARDWARE_OPEN Serial2
136+
137+
#define USB_MAX_POWER (500)
138+
139+
#endif //__PINS_ARDUINO__

variants/PORTENTA_X8/variant.cpp

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#include "Arduino.h"
2+
#include "pinDefinitions.h"
3+
4+
AnalogPinDescription g_AAnalogPinDescription[] = {
5+
{ PF_11, NULL }, // A0 ADC1_INP2
6+
{ PA_6, NULL }, // A1 ADC12_INP3
7+
{ PF_13, NULL }, // A2 ADC2_INP2
8+
{ PB_1, NULL }, // A3 ADC12_INP5
9+
{ PC_4, NULL }, // A4 ADC12_INP4
10+
{ PF_7, NULL }, // A5 ADC3_INP3
11+
{ PF_9, NULL }, // A6 ADC3_INP2
12+
{ PF_5, NULL } // A7 ADC3_INP4
13+
};
14+
15+
PinDescription g_APinDescription[] = {
16+
// D0 - D6
17+
{ PF_8, NULL, NULL, NULL }, // D0
18+
{ PF_6, NULL, NULL, NULL }, // D1
19+
{ PF_3, NULL, NULL, NULL }, // D2
20+
{ PF_4, NULL, NULL, NULL }, // D3
21+
{ PF_12, NULL, NULL, NULL }, // D4
22+
{ PE_10, NULL, NULL, NULL }, // D5
23+
{ PE_11, NULL, NULL, NULL }, // D6
24+
25+
// D7 - D14
26+
{ PF_11, NULL }, // D7 A0
27+
{ PA_6, NULL }, // D8 A1
28+
{ PF_13, NULL }, // D9 A2
29+
{ PB_1, NULL }, // D10 A3
30+
{ PC_4, NULL }, // D11 A4
31+
{ PF_7, NULL }, // D12 A5
32+
{ PF_9, NULL }, // D13 A6
33+
{ PF_5, NULL }, // D14 A7
34+
35+
// CAN
36+
{ PD_1, NULL, NULL, NULL }, // D15
37+
{ PD_0, NULL, NULL, NULL }, // D16
38+
{ PB_6, NULL, NULL, NULL }, // D17
39+
{ PB_5, NULL, NULL, NULL }, // D18
40+
41+
// USART2
42+
{ PD_3, NULL, NULL, NULL }, // D19
43+
{ PD_4, NULL, NULL, NULL }, // D20
44+
{ PD_5, NULL, NULL, NULL }, // D21
45+
{ PD_6, NULL, NULL, NULL }, // D22
46+
47+
// PWM
48+
{ PC_7, NULL, NULL, NULL }, // D23
49+
{ PA_9, NULL, NULL, NULL }, // D24
50+
{ PA_10, NULL, NULL, NULL }, // D25
51+
{ PB_10, NULL, NULL, NULL }, // D26
52+
{ PA_11, NULL, NULL, NULL }, // D27
53+
{ PD_15, NULL, NULL, NULL }, // D28
54+
{ PA_15, NULL, NULL, NULL }, // D29
55+
{ PC_6, NULL, NULL, NULL }, // D30
56+
{ PA_12, NULL, NULL, NULL }, // D31
57+
{ PC_8, NULL, NULL, NULL }, // D32
58+
59+
// INTERNAL
60+
{ PA_0, NULL, NULL, NULL }, // D33
61+
{ PC_1, NULL, NULL, NULL }, // D34
62+
{ PE_5, NULL, NULL, NULL }, // D35
63+
64+
};
65+
66+
extern "C" {
67+
unsigned int PINCOUNT_fn() {
68+
return (sizeof(g_APinDescription) / sizeof(g_APinDescription[0]));
69+
}
70+
}

0 commit comments

Comments
 (0)