regus_pregus

Forum Replies Created

Viewing 16 post (of 16 total)
  • Author
    Posts
  • regus_pregus
    Participant

    Thank you both for your responses.


    @parsec67
    : yes, you were correct to point in the direction of IVT location as a culprit.

    @support: thanks for pointing in the right direction towards the solution. After defining VECT_TAB_SRAM manually, the code would still hang, but I was on the right track, because I was also now able to compare what else good and bad demo do before main(). It turns out that in addition to defining this macro so that SCB->VTOR gets initialized with alternative value, you also need to patch that initialization code a bit:

    Instead of

    SCB->VTOR = SRAM1_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */

    you need

    SCB->VTOR = RAMDTCM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */

    becasue SRAM1_BASE would set up VTOR in wrong location in SRAM. The good demo (STM32F7-Discovery LCD Demo, the one that doesn’t hang) does exactly this (uses RAMDTCM_BASE) and never hangs, because RAMDTCM_BASE points to the beginning of SRAM where the IVT should be, while SRAM1_BASE points to 0x20010000.

    After these two changes the bad demo starts working from SRAM without any hanging, mission accomplished.

    Also, I noticed that in Reset_Handler() the first instruction is this:

    #ifdef sram_layout
    asm ("ldr sp, =_estack");
    #endif

    sram_layout is also not defined in bad demo and is defined in good demo (and therefore inline asm instruction is not executed in bad demo), but defining it in bad demo had no effect on the code execution, but it might be a good idea to also define it in the patch for consistency sake.

    So, for the purposes of the upcoming patch, here are the fixes:

    1. Define VECT_TAB_SRAM macro, as you suggested
    2. Additionally, use RAMDTCM_BASE instead of SRAM1_BASE in SystemInit() of system_stm32f7xx.c
    3. Possibly define sram_layout macro as an additional precaution

    Thank you for great support. We are on 30-day trial right now with VisualGDB, test-driving it versus other STM32 programming solutions and I can tell you that both the product and your support are winning so far, which will more than likely result in a purchase at the end of the trial.

Viewing 16 post (of 16 total)