This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

usb host bootloader

Hi all
I have problem with usb host boot loader , if the button is pressed the bootloader reads the binary code from the usb stick and writes this own at application memory from 0x8008000
after debugging it seems this is ok .

if the button is not pressed , the bootloader should jump at the application , but it does not do , it stucks in the default handler .

in the application code I set the target ROM1 start 0x800800
and I defined VECT_TAB_OFFSET to 0x800

but no way it doesnt not work . my bootloader code depends on the code of the discovery kit of
stm32f407 from ST, my MCU is stm32f407.
Could you guide me to solve it problem please ?

Regards
S. Sami

Parents
  • Thank you Thorsten de Buhr

    But could you explain your code please ?

    here is my bootloader code and how can arrange it to work with yours .

    
    int main(void)
    {
      /* STM32 evalboard user initialization */
      BSP_Init();
    
      /* Flash unlock */
      FLASH_If_FlashUnlock();
    
      /* Test if User button on the Discovery kit is pressed */
      //if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_RESET)
            if(GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_0)==1)//
      {
        /* Check Vector Table: Test if user code is programmed starting from address
           "APPLICATION_ADDRESS" */
    
        if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
        {
          /* Jump to user application */
          JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
    
          Jump_To_Application = (pFunction) JumpAddress;
          /* Initialize user application's Stack Pointer */
          __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
          Jump_To_Application();
        }
      }
    
      /* Init Host Library */
      USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks);
    
      while (1)
      {
        /* Host Task handler */
        USBH_Process(&USB_OTG_Core, &USB_Host);
      }
    }
    
    
    
    
    
    

    .

    Regards
    S.Sami

Reply
  • Thank you Thorsten de Buhr

    But could you explain your code please ?

    here is my bootloader code and how can arrange it to work with yours .

    
    int main(void)
    {
      /* STM32 evalboard user initialization */
      BSP_Init();
    
      /* Flash unlock */
      FLASH_If_FlashUnlock();
    
      /* Test if User button on the Discovery kit is pressed */
      //if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_RESET)
            if(GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_0)==1)//
      {
        /* Check Vector Table: Test if user code is programmed starting from address
           "APPLICATION_ADDRESS" */
    
        if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
        {
          /* Jump to user application */
          JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
    
          Jump_To_Application = (pFunction) JumpAddress;
          /* Initialize user application's Stack Pointer */
          __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
          Jump_To_Application();
        }
      }
    
      /* Init Host Library */
      USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks);
    
      while (1)
      {
        /* Host Task handler */
        USBH_Process(&USB_OTG_Core, &USB_Host);
      }
    }
    
    
    
    
    
    

    .

    Regards
    S.Sami

Children
No data