0
\$\begingroup\$

I am a beginner in arm cortex m7, i bought NUCLEO-F756ZG board and when i was trying to apply this tutorial i faced two difficulties.

First: i didn't find linker script for my board (NUCLEO-F756ZG) in STM32CubeF7 file like STM32F401CE_FLASH.ld file for Nucleo-F401RE

Second: i didn't find .cfg file for my board (NUCLEO-F756ZG) to use with openocd (openocd -f <.cfg file>)

$ cd /usr/share/openocd/scripts/board/

$ ls st*

steval_pcc010.cfg

stm320518_eval.cfg

stm320518_eval_stlink.cfg

stm32100b_eval.cfg

stm3210b_eval.cfg

stm3210c_eval.cfg

stm3210e_eval.cfg

stm3220g_eval.cfg

stm3220g_eval_stlink.cfg

stm3241g_eval.cfg

stm3241g_eval_stlink.cfg

stm32429i_eval.cfg

stm32429i_eval_stlink.cfg

stm32439i_eval.cfg

stm32439i_eval_stlink.cfg

stm32f0discovery.cfg

stm32f334discovery.cfg

stm32f3discovery.cfg

stm32f429discovery.cfg

stm32f4discovery.cfg

stm32l0discovery.cfg

stm32ldiscovery.cfg

stm32vldiscovery.cfg

st_nucleo_f0.cfg

st_nucleo_f103rb.cfg

st_nucleo_f3.cfg

st_nucleo_f4.cfg

st_nucleo_l1.cfg

str910-eval.cfg

my openocd version:

$ openocd -v

Open On-Chip Debugger 0.9.0 (2018-01-21-13:43)

file:

main.c

system.c

startup_stm32f756xx.s

code:

main.c

#include <stm32f756xx.h> 

#define LED_PIN 5
#define LED_ON() GPIOA->BSRR |= (1 << 5)
#define LED_OFF() GPIOA->BSRR |= (1 << 21)

int main()
{
    RCC -> AHB1ENR |= RCC_AHB1ENR_GPIOAEN;

    GPIOA -> MODER |= (1 << (LED_PIN << 1));

    GPIOA -> OSPEEDR |= (3 << (LED_PIN << 1));

    LED_ON();
}

system.c

#include <stm32f756xx.h>

#define SYSTEM_INIT_ERROR_FLASH 0x01

void SystemInit()
{
    RCC -> APB1ENR |= RCC_APB1LPENR_PWRLPEN;

    PWR -> CR1 |= PWR_CR1_VOS_1;

    while ((RCC->CR & RCC_CR_HSIRDY) == 0);

    PWR -> CR1 |= (uint32_t)(16 << 3);

    RCC -> CR &= ~(RCC_CR_PLLON);

    while ((RCC->CR & RCC_CR_PLLRDY) != 0);

    RCC -> PLLCFGR = (uint32_t)((uint32_t) 0x20000000 | (uint32_t)(16 << 0)
        | (uint32_t)(336 << 6) | RCC_PLLCFGR_PLLP_0
        | (uint32_t)(7 << 24));

    RCC -> CR |= RCC_CR_PLLON;

    while ((RCC -> CR & RCC_CR_PLLRDY) == 0);

    FLASH -> ACR |= /* FLASH_ACR_ICEN |*/ FLASH_ACR_PRFTEN |
        FLASH_ACR_LATENCY_2WS;

    if ((FLASH -> ACR & FLASH_ACR_LATENCY) != FLASH_ACR_LATENCY_2WS)
    {
        SystemInitError(SYSTEM_INIT_ERROR_FLASH);
    }

    RCC -> CFGR |= RCC_CFGR_SW_PLL;

    while ((RCC -> CFGR & RCC_CFGR_SWS_PLL) != RCC_CFGR_SWS_PLL);

    RCC -> CFGR &= ~(RCC_CFGR_HPRE);

    RCC -> CFGR |= RCC_CFGR_PPRE1_DIV2;

    RCC -> CFGR &= ~(RCC_CFGR_PPRE2);
}

void SystemInitError(uint8_t error_source)
{
    while(1);
}

What shall i do?

\$\endgroup\$
  • \$\begingroup\$ Requests for code aren't really on topic here. Likely you should look for the processor and not just the board - possibly you will need to take time to understand which members of the sub-family are close enough to be code interchangeable. As for OpenOCD, you'd have to check on their mailing list for support (or assist in creating that from the chip documentation), in the meantime the drag-and-drop fake mass storage feature should work for programming a Nucleo board. If you do not have a specific requirement for an F7 perhaps you should start with a more common part first \$\endgroup\$ – Chris Stratton Apr 14 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.