Skip to content

Commit 5f2ff68

Browse files
authored
Merge pull request #3350 from cesanta/portenta
fix Portenta Cube after cyw.h updates
2 parents 6e72bf4 + 8eaca94 commit 5f2ff68

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

tutorials/stm32/portenta-h7-cube-baremetal-builtin/CM7/Core/Inc/mongoose_config.h

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,11 @@
33
// See https://mongoose.ws/documentation/#build-options
44
#define MG_ARCH MG_ARCH_ARMGCC
55
#define MG_TLS MG_TLS_BUILTIN
6-
#define MG_OTA MG_OTA_STM32H7_DUAL_CORE
6+
//#define MG_OTA MG_OTA_STM32H7_DUAL_CORE
77
#define MG_IRAM __attribute__((section(".RamFunc")))
88

99
#define MG_ENABLE_TCPIP 1
1010
#define MG_ENABLE_CUSTOM_MILLIS 1
1111
#define MG_ENABLE_CUSTOM_RANDOM 1
1212
#define MG_ENABLE_DRIVER_CYW_SDIO 1
13-
#define MG_ENABLE_PACKED_FS 1
14-
15-
// #define MG_DRIVER_MDC_CR 4 // RMII MDC clock divider, from 0 to 5
16-
// #define MG_TCPIP_PHY_ADDR 0 // PHY address
17-
18-
// For static IP configuration, define MG_TCPIP_{IP,MASK,GW}
19-
// By default, those are set to zero, meaning that DHCP is used
20-
//
21-
// #define MG_TCPIP_IP MG_IPV4(192, 168, 0, 10) // IP
22-
// #define MG_TCPIP_GW MG_IPV4(192, 168, 0, 1) // Gateway
23-
// #define MG_TCPIP_MASK MG_IPV4(255, 255, 255, 0) // Netmask
24-
25-
// Construct MAC address from the MCU unique ID. It is defined in the
26-
// ST CMSIS header as UID_BASE
27-
#define MGUID ((uint32_t *) 0x1ff1e800) // Unique 96-bit chip ID
28-
#define MG_SET_MAC_ADDRESS(mac) \
29-
do { \
30-
mac[0] = 2; \
31-
mac[1] = MGUID[0] & 255; \
32-
mac[2] = (MGUID[0] >> 10) & 255; \
33-
mac[3] = (MGUID[0] >> 19) & 255; \
34-
mac[4] = MGUID[1] & 255; \
35-
mac[5] = MGUID[2] & 255; \
36-
} while (0)
13+
#define MG_ENABLE_TCPIP_DRIVER_INIT 0

tutorials/stm32/portenta-h7-cube-baremetal-builtin/CM7/Core/Src/main.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,24 @@ int main(void)
294294

295295
/* USER CODE END 1 */
296296
/* USER CODE BEGIN Boot_Mode_Sequence_0 */
297-
int32_t timeout;
297+
// int32_t timeout;
298298
/* USER CODE END Boot_Mode_Sequence_0 */
299299

300300
/* USER CODE BEGIN Boot_Mode_Sequence_1 */
301301
/* Wait until CPU2 boots and enters in stop mode or timeout*/
302+
#if 0
303+
// leave CM4 alone
302304
timeout = 0xFFFF;
303305
while((__HAL_RCC_GET_FLAG(RCC_FLAG_D2CKRDY) != RESET) && (timeout-- > 0));
304306
if ( timeout < 0 )
305307
{
306-
Error_Handler();
308+
Error_Handler();
307309
}
310+
#endif
308311
/* USER CODE END Boot_Mode_Sequence_1 */
309312
/* MCU Configuration--------------------------------------------------------*/
310313

311-
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
314+
/* Reset of all peripherals, Initializes the Flash interface and the SysTick. */
312315
HAL_Init();
313316

314317
/* USER CODE BEGIN Init */
@@ -318,6 +321,8 @@ int main(void)
318321
/* Configure the system clock */
319322
SystemClock_Config();
320323
/* USER CODE BEGIN Boot_Mode_Sequence_2 */
324+
#if 0
325+
// leave CM4 alone
321326
/* When system initialization is finished, Cortex-M7 will release Cortex-M4 by means of
322327
HSEM notification */
323328
/*HW semaphore Clock enable*/
@@ -333,6 +338,7 @@ if ( timeout < 0 )
333338
{
334339
Error_Handler();
335340
}
341+
#endif
336342
/* USER CODE END Boot_Mode_Sequence_2 */
337343

338344
/* USER CODE BEGIN SysInit */

tutorials/stm32/portenta-h7-make-baremetal-builtin/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ firmware.elf: cmsis_core cmsis_mcu mbed $(SOURCES) $(wildcard *.h) link.ld Makef
2626
arm-none-eabi-gcc $(SOURCES) $(CFLAGS) $(LDFLAGS) -o $@
2727

2828
flash: firmware.bin
29-
STM32_Programmer_CLI -c port=swd -w $< 0x8040000 -hardRst
29+
dfu-util -a 0 -s 0x8040000:leave -D $<
30+
# connecting SWD: STM32_Programmer_CLI -c port=swd -w $< 0x8040000 -hardRst
3031

3132
cmsis_core: # ARM CMSIS core headers
3233
git clone --depth 1 -b 5.9.0 https://github.com/ARM-software/CMSIS_5 $@

tutorials/stm32/portenta-h7-make-baremetal-builtin/mongoose_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// See https://mongoose.ws/documentation/#build-options
44
#define MG_ARCH MG_ARCH_ARMGCC
55
#define MG_TLS MG_TLS_BUILTIN
6-
#define MG_OTA MG_OTA_STM32H7_DUAL_CORE
6+
//#define MG_OTA MG_OTA_STM32H7_DUAL_CORE
77

88
#define MG_ENABLE_TCPIP 1
99
#define MG_ENABLE_CUSTOM_MILLIS 1

0 commit comments

Comments
 (0)