Skip to content

CMake: define DATA_IN_D2_SRAM so SystemInit enables the D2 SRAM blocks - #713

Open
zeroisnan wants to merge 1 commit into
electro-smith:masterfrom
zeroisnan:cmake-data-in-d2-sram
Open

CMake: define DATA_IN_D2_SRAM so SystemInit enables the D2 SRAM blocks#713
zeroisnan wants to merge 1 commit into
electro-smith:masterfrom
zeroisnan:cmake-data-in-d2-sram

Conversation

@zeroisnan

Copy link
Copy Markdown
Contributor

Fixes #712.

The CMake build never defined DATA_IN_D2_SRAM, so the RCC->AHB2ENR write in
SystemInit() was compiled out and the D2 AHB SRAM blocks were left disabled.
That is where DMA_BUFFER_MEM_SECTION puts the audio, ADC, MIDI and USB-host DMA
buffers. The Makefile has passed the define since #390.

system_stm32h7xx.c is built by CMSIS_DEVICE_H7 rather than daisy, so the
define goes on that target. PRIVATE matches the Makefile, which passes it when
building libDaisy and not to the application.

Verified on examples/AudioPassthru with arm-none-eabi-gcc 13.2.1, Release:
AHB2ENR |= 0xE0000000 is now present in the CMake build's SystemInit (inlined
into Reset_Handler by LTO), matching the Makefile build. Costs 24 bytes of flash.
cmake --build build --target examples builds clean.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CMake: define mismatch with Make flow (missing DATA_IN_D2_SRAM)

1 participant