nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

Adds bare bones Arduino Portenta H7 port which is mostly a copy of STM32H747I-DISCO port.

Open antmerlino opened this issue 4 years ago • 15 comments

Summary

Adds bare bones support for Arduino Portenta H7

Impact

None.

Testing

Got a nsh console over USART1

antmerlino avatar Mar 24 '21 21:03 antmerlino

Hi @antmerlino please fix the coding style issues and other issues.

acassis avatar Mar 25 '21 22:03 acassis

@acassis Will do... I'm tied up with some other things at the moment but I'll clean it up in the coming week.

antmerlino avatar Mar 26 '21 03:03 antmerlino

@antmerlino CI fails looks like you need to rebase on master.

davids5 avatar May 17 '21 13:05 davids5

@antmerlino do you intend to continue with this contribution?

microhobby avatar Aug 15 '21 17:08 microhobby

@antmerlino do you intend to continue with this contribution?

@microhobby I don't plan to develop the Portenta platform further, but I would like to find the time to finish this basic support and get it merged. Just hasn't been a priority.

antmerlino avatar Aug 21 '21 01:08 antmerlino

@antmerlino do you intend to continue with this contribution?

@microhobby I don't plan to develop the Portenta platform further, but I would like to find the time to finish this basic support and get it merged. Just hasn't been a priority.

@antmerlino ok, no problem, I would like to help. I'm working on a linker to use DFU bootloader, as I don't have any breakout with access to programmer pins. But now I'm stuck in a hardfault:

up_assert: Assertion failed at file:irq/irq_unexpectedisr.c line: 51
up_registerdump: R0: 0000001e 00000000 e000ed14 00070200 e000ed0b ffffffff e000e100 00000000
up_registerdump: R8: 00000000 00000000 24070000 00000000 00000018 24000f38 08041381 00000000
up_registerdump: xPSR: 00000200 PRIMASK: 00000000 CONTROL: 00000000
up_registerdump: EXC_RETURN: ffffffe9

Can you confirm that with your patches it is possible to access nsh without problems? I don't know if this is due to a rebase with the master, or my linker script... Thanks in advance.

microhobby avatar Aug 21 '21 14:08 microhobby

🤔 setting flash section to 0x0804000 and defining # CONFIG_ARMV7M_DCACHE is not set to the defconfig made a working nsh through the default DFU bootloader from Portenta. But to be honest I'm not sure if this has any side effects ...

microhobby avatar Aug 24 '21 06:08 microhobby

@microhobby this offset 0x0804000 should depend of CONFIG_STM32H7_DFU please search for CONFIG_STM32_DFU for reference (it is defined at arch/arm/src/stm32/Kconfig)

acassis avatar Aug 24 '21 13:08 acassis

@microhobby this offset 0x0804000 should depend of CONFIG_STM32H7_DFU please search for CONFIG_STM32_DFU for reference (it is defined at arch/arm/src/stm32/Kconfig)

Yeah, I did exactly this! Thanks @acassis. For now my changes are here: https://github.com/dotnuttx/incubator-nuttx/commit/51e57d048d67456a1287f8256b3115f119b80f23

microhobby avatar Aug 24 '21 14:08 microhobby

@antmerlino you still need to rebase your https://github.com/antmerlino/incubator-nuttx/tree/arduino-portenta with the https://github.com/apache/incubator-nuttx/tree/master . I think this would solve the checks issues, thanks.

microhobby avatar Mar 25 '22 18:03 microhobby

@antmerlino I tried to build it on my environment and I had the same error:

./stm32_boot.c:32:10: fatal error: arm_arch.h: No such file or directory
   32 | #include "arm_arch.h"
      |          ^~~~~~~~~~~~
compilation terminated.
ERROR: arm-none-eabi-gcc failed: 1
       command: arm-none-eabi-gcc -M '-fno-builtin' '-Wall' '-Wstrict-prototypes' '-Wshadow' '-Wundef' '-g' '-Os' '-fomit-frame-pointer' '-fno-strict-aliasing' '-fno-strength-reduce' '-fomit-frame-pointer' '-march=armv7e-m' '-mtune=cortex-m7' '-mthumb' '-mfpu=fpv5-d16' '-mfloat-abi=hard' '-isystem' '/home/castello/projects/N/dotnuttx/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-pipe' '-I' '/home/castello/projects/N/dotnuttx/nuttx/sched' '-I' '/home/castello/projects/N/dotnuttx/nuttx/arch/arm/src/chip' '-I' '/home/castello/projects/N/dotnuttx/nuttx/arch/arm/src/common' '-I' '/home/castello/projects/N/dotnuttx/nuttx/arch/arm/src/armv7-m' ./stm32_boot.c

With the rebase something from master degraded the portenta build 😔

microhobby avatar Mar 26 '22 04:03 microhobby

@antmerlino this commit, we need to change also the portenta stm32_boot.c https://github.com/dotnuttx/incubator-nuttx/commit/54e630e14d7e32d6f81ae79d4e5df3d2fa787ef0

microhobby avatar Mar 26 '22 04:03 microhobby

@antmerlino Sorry for the delay, but other things have also changed. I put it in some reviews. I believe that it's all now (at least I had one successful build on my environment). Thanks for working on it.

microhobby avatar Mar 26 '22 04:03 microhobby

@antmerlino I think that the best would check again the STM32H747I-DISCO base changes to match with the portenta port, unfortunately many things have been changed in NuttX during the time PR has been open. Although a build with nsh is possible, the code is out of date with what was done in NuttX 😔 (please don't be discouraged, we are close!)

microhobby avatar Mar 26 '22 14:03 microhobby

@antmerlino the files that are still not in the apache license format:

https://github.com/antmerlino/incubator-nuttx/blob/arduino-portenta/boards/arm/stm32h7/portenta-h7/scripts/user-space.ld

https://github.com/antmerlino/incubator-nuttx/blob/arduino-portenta/boards/arm/stm32h7/portenta-h7/scripts/memory.ld

https://github.com/antmerlino/incubator-nuttx/blob/arduino-portenta/boards/arm/stm32h7/portenta-h7/scripts/kernel.space.ld

https://github.com/antmerlino/incubator-nuttx/blob/arduino-portenta/boards/arm/stm32h7/portenta-h7/kernel/stm32_userspace.c

microhobby avatar Mar 29 '22 14:03 microhobby