Closes the link for the STM32F746ZGT7 bring-up:
- linker/STM32F746ZGTx_FLASH.ld: 1 MB flash @ 0x08000000, 256 KB RAM @
0x20010000 (SRAM1+SRAM2 contiguous), 64 KB DTCM for stack/heap, 16 KB
ITCM. Standard Cube-style section layout.
- 9_1_3_C_Cpp_Code/usb_device.{h,c}: MX_USB_DEVICE_Init wiring CDC class
+ interface into hUsbDeviceFS.
- 9_1_3_C_Cpp_Code/usbd_conf.{h,c}: HAL PCD bridge — hpcd_USB_OTG_FS,
USBD_LL_* callbacks, HAL_PCD_MspInit (PA11/PA12 AF10, OTG_FS clock,
OTG_FS_IRQn), static allocator for USBD_malloc.
- 9_1_3_C_Cpp_Code/usbd_desc.{h,c}: device + string descriptors, VID
0x0483 / PID 0x5740 (STM32 VCP), serial derived from 96-bit UID.
- 9_1_3_C_Cpp_Code/usbd_cdc_if.{h,c}: CDC_Transmit_FS + class callbacks;
host-to-device bytes forwarded via weak CDC_on_receive hook so
USBHandler can override from C++ without a hard dep.
Makefile:
- default target now 'link' (produces firmware.elf/.bin/.hex).
- APP_CPP no longer excludes main.cpp; LIB_CPP no longer excludes
gps_handler.cpp.
- USB_C picks up Core + CDC class .c files (minus *_template.c).
- Drops vendor system_stm32f7xx.c — the app-customised copy in
9_1_1_C_Cpp_Libraries/ is the real one; keeping both caused duplicate
symbols.
Incidental fixes to main.cpp (pre-existing bugs exposed by first real
compile):
- DIAG_GPIO at main.cpp:662-663 was called with 3 args; macro takes
(subsys, name, port, pin). Passed the STATUS0/STATUS1 port+pin pair.
- PI used at main.cpp:1589-1594 for atan2 conversions but never
defined. Added a local #define PI 3.14159265358979323846f near the
top of the file.
Result: firmware.elf = 118 548 B text / 776 B data / 12 672 B bss.
Fits comfortably in 1 MB flash; DTCM stack/heap clears 64 KB with room.
First of three planned PRs to produce a bootable STM32F746ZGT7 firmware
image from the sources already in-tree. The original CubeIDE project
(.ioc + generated Core/Drivers/Middlewares) never made it into the repo,
so the build is being reconstructed from scratch against the vendored HAL.
Scope of this PR:
- Pin arm-none-eabi-gcc 15 (brew --cask gcc-arm-embedded) as the
toolchain for local macOS builds.
- Vendor trimmed copies of the four upstream trees needed by a minimal
STM32F7 project:
* CMSIS_5 5.9.0 Cortex-M7 Core/Include subset (256 KB)
* cmsis_device_f7 v1.2.8 F746-only device header + startup (1 MB)
* stm32f7xx_hal_driver v1.3.1 full HAL Inc/Src (9.3 MB)
* stm32_mw_usb_device v2.11.3 Core + Class/CDC (200 KB)
Total vendor tree: 11 MB, 228 files. VERSION files pin each drop.
- Add Makefile targeting -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard.
`make compile` produces 150 objects covering:
* all enabled HAL modules (GPIO/EXTI/DMA/RCC/FLASH/PWR/I2C/CORTEX/
IWDG/SPI/TIM/UART/PCD per stm32f7xx_hal_conf.h)
* the no-os ADI middleware layer
* ADAR1000/ADF4382/AD9523/BMP180/GY-85/TinyGPS++ drivers
* um982_gps, platform_noos_stm32, system_stm32f7xx, startup
Deliberately excluded (need PR 2 Cube glue):
* main.cpp / gps_handler.cpp — require usb_device.h, usbd_cdc_if.h
* USB Device Library sources — require user-provided usbd_conf.h
* *_template.c — ST user-copy stubs, never compiled
Incidental fixes folded in (these are hard blockers, not cosmetic):
- Delete 9_1_1_C_Cpp_Libraries/errno.h. It was an ADI armcc-only shim
whose EINVAL/ENOENT/etc. macros are gated on __ARMCC_VERSION and
relies on `#include_next <errno.h>`, which gcc refuses when the file
was found via quoted-include in the source directory. With the shim
gone every `#include "errno.h"` / `#include <errno.h>` now resolves
straight to newlib's, which is what every other TU in the tree
already assumed.
- Makefile demotes four gcc-15 defaults back to warnings
(-Wno-error=incompatible-pointer-types/discarded-qualifiers/
int-conversion/implicit-function-declaration). gcc 14 promoted
these to errors by default; the underlying diagnostics are
pre-existing type mismatches in the ADI no-os layer (e.g. const
qualifier dropped in stm32_dma.c:281 function-pointer assignment),
not new regressions. Real fixes are out of scope for PR 1.
Still to come:
PR 2 — hand-written Cube glue: STM32F746ZGTx_FLASH.ld, stm32f7xx_it.c,
stm32f7xx_hal_msp.c, SystemClock_Config, MX_*_Init for the
peripherals in main.cpp, usbd_conf.{h,c}, usbd_desc.c,
usbd_cdc_if.c, and a C main() shim that calls into app_main().
Closes the link; produces firmware.elf/.bin/.hex.
PR 3 — hardware bring-up: flash, iterate on HSE/PLL + DMA + SPI mode
against the real board until the existing firmware behaviour
is restored.