Uploading to STM32F407VG Discovery board fails

found my error, ty for doing rubber duck debugging, forum.
apparently I was missing all the assembly files and other stuff that’s needed for the controller to start up properly, especially these lines here in my platform.ini:

src_filter = 
  ${common.src_filter} 
  +<controllers/stm32f407vg/>

And the individual enabling of the specific Ports A, B, D is also missing:

void InitGPIO()
{
    SystemInit();
    constexpr int PD12 = 12;
    ENABLE(RCC->AHB1ENR, 3);              // Enable clock for Port D = 3
    ENABLE(GPIOD->MODER, 2 * PD12);       // 0b01 -> General Purpose ouput
    DISABLE(GPIOD->MODER, (2 * PD12) + 1);// set PD12 to Output

    // PA0 - External Input
    constexpr int PA0 = 0;
    ENABLE(RCC->AHB1ENR, 0);           // Enable Clock for Port A = 0
    DISABLE(GPIOA->MODER, 2 * PA0);      // set PA0 to be an input
    DISABLE(GPIOA->MODER, (2 * PA0) + 1);// PA0 input   

    // PB3 - Input
    constexpr int PB3 = 3;
    ENABLE(RCC->AHB1ENR, 1);           // Enable Clock for Port B = 1
    DISABLE(GPIOB->MODER, 2 * PB3);      // set PB3 to be an input
    DISABLE(GPIOB->MODER, (2 * PB3) + 1);// PB3 input  
    
}
1 Like