Skip to content

Commit

Permalink
bootloader debug in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
robotsrulz committed Jun 29, 2017
1 parent 29d9ddc commit bd1a70a
Show file tree
Hide file tree
Showing 3 changed files with 466 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void osDelay(__IO uint32_t Delay)

inline void moveVectorTable(uint32_t Offset)
{
__disable_irq();
// __disable_irq();
SCB->VTOR = FLASH_BASE | Offset;
}

Expand All @@ -94,13 +94,11 @@ int main(void)
MX_FATFS_Init();
ShortBeep();

if (FR_OK == f_mount(&sdFileSystem, SPISD_Path, 1) && FR_OK == flash("0:/firmware.bin"))
{
f_mount(NULL, SPISD_Path, 1);
// if (FR_OK == f_mount(&sdFileSystem, SPISD_Path, 1) && FR_OK == flash("0:/firmware.bin"))
// {
// f_mount(NULL, SPISD_Path, 1);
ShortBeep();

// HAL_DeInit();

HAL_SPI_MspDeInit(&hspi1);
HAL_TIM_Base_MspDeInit(&htim2);

Expand All @@ -110,22 +108,24 @@ int main(void)
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();

HAL_DeInit();

// Disabling SysTick interrupt
// SysTick->CTRL = 0;
SysTick->CTRL = 0;
moveVectorTable(MAIN_PR_OFFSET);
// Setting initial value to stack pointer
__set_MSP(*mcuFirstPageAddr);
// booting really

Callable mainPResetHandler = (Callable) (*(mcuFirstPageAddr + 1) );
mainPResetHandler();
Callable resetHandler = (Callable) (*(mcuFirstPageAddr + 1) );
resetHandler();

/*
register uint32_t addr = (uint32_t) *(mcuFirstPageAddr + 1);
addr ^= 1;
Callable mainPResetHandler = (Callable) addr;
*/
}
// }

while (1) {
ShortBeep();
Expand Down
8 changes: 8 additions & 0 deletions MKS-TFT32.ebp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@
</Unit>
<Unit filename="Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c">
<Option compilerVar="CC" />
<Option target="MKS-TFT32" />
<Option target="F103ZET6_28" />
<Option target="F103ZET6_50" />
<Option target="MKS-BOOT" />
</Unit>
<Unit filename="Drivers\CMSIS\Include\arm_common_tables.h" />
<Unit filename="Drivers\CMSIS\Include\arm_const_structs.h" />
Expand Down Expand Up @@ -1080,6 +1084,10 @@
<Option target="F103ZET6_50" />
<Option target="MKS-TFT32 4B" />
</Unit>
<Unit filename="Src\system_stm32f1xx_4boot.c">
<Option compilerVar="CC" />
<Option target="MKS-TFT32 4B" />
</Unit>
<Unit filename="Src\usb_host.c">
<Option compilerVar="CC" />
<Option virtualFolder="Hardware\MKS-TFT\" />
Expand Down
Loading

0 comments on commit bd1a70a

Please sign in to comment.