From 3a352025f9ee517a25da77c19434e8282540949a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 28 Mar 2021 17:29:27 +0200 Subject: [PATCH] sysmocom_rfdsatt: Actuall "port" over to our target This patch changes whatever is different bethween the Olimex P103 and the sysmocom rfdsatt board --- .../Boot/blt_conf.h | 10 ++++++---- .../Boot/hooks.c | 2 ++ .../Boot/led.c | 6 +++--- .../Boot/main.c | 16 +++++++++------- .../Boot/makefile | 3 ++- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/blt_conf.h b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/blt_conf.h index d0893941..06e46744 100644 --- a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/blt_conf.h +++ b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/blt_conf.h @@ -46,7 +46,7 @@ /** \brief Frequency of the external crystal oscillator. */ #define BOOT_CPU_XTAL_SPEED_KHZ (8000) /** \brief Desired system speed. */ -#define BOOT_CPU_SYSTEM_SPEED_KHZ (72000) +#define BOOT_CPU_SYSTEM_SPEED_KHZ (36000) /** \brief Motorola or Intel style byte ordering. */ #define BOOT_CPU_BYTE_ORDER_MOTOROLA (0) /** \brief Enable/disable hook function call right before user program start. */ @@ -70,7 +70,7 @@ * */ /** \brief Enable/disable CAN transport layer. */ -#define BOOT_COM_CAN_ENABLE (1) +#define BOOT_COM_CAN_ENABLE (0) /** \brief Configure the desired CAN baudrate. */ #define BOOT_COM_CAN_BAUDRATE (500000) /** \brief Configure CAN message ID target->host. */ @@ -95,7 +95,7 @@ /** \brief Enable/disable UART transport layer. */ #define BOOT_COM_RS232_ENABLE (1) /** \brief Configure the desired communication speed. */ -#define BOOT_COM_RS232_BAUDRATE (57600) +#define BOOT_COM_RS232_BAUDRATE (115200) /** \brief Configure number of bytes in the target->host data packet. */ #define BOOT_COM_RS232_TX_MAX_DATA (64) /** \brief Configure number of bytes in the host->target data packet. */ @@ -182,7 +182,7 @@ * a different checksum location, because this one is added at the end of the * user program's vector table. */ -#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x10c) +#define BOOT_FLASH_VECTOR_TABLE_CS_OFFSET (0x150) /**************************************************************************************** @@ -218,6 +218,8 @@ */ #define BOOT_XCP_SEED_KEY_ENABLE (0) +#define BOOT_FLASH_CUSTOM_LAYOUT_ENABLE (1) + #endif /* BLT_CONF_H */ /*********************************** end of blt_conf.h *********************************/ diff --git a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/hooks.c b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/hooks.c index fc1d759e..20378f6b 100644 --- a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/hooks.c +++ b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/hooks.c @@ -80,6 +80,7 @@ blt_bool BackDoorEntryHook(void) ****************************************************************************************/ blt_bool CpuUserProgramStartHook(void) { +#if 0 /* additional and optional backdoor entry through the pushbutton on the board. to * force the bootloader to stay active after reset, keep it pressed during reset. */ @@ -90,6 +91,7 @@ blt_bool CpuUserProgramStartHook(void) */ return BLT_FALSE; } +#endif /* clean up the LED driver */ LedBlinkExit(); diff --git a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/led.c b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/led.c index 328a4b2a..471397ba 100644 --- a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/led.c +++ b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/led.c @@ -72,12 +72,12 @@ void LedBlinkTask(void) if (ledOn == BLT_FALSE) { ledOn = BLT_TRUE; - LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_12); + LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_15); } else { ledOn = BLT_FALSE; - LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_12); + LL_GPIO_SetOutputPin(GPIOB, LL_GPIO_PIN_15); } /* schedule the next blink event */ nextBlinkEvent = TimerGet() + ledBlinkIntervalMs; @@ -94,7 +94,7 @@ void LedBlinkTask(void) void LedBlinkExit(void) { /* turn the LED off */ - LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_12); + LL_GPIO_SetOutputPin(GPIOB, LL_GPIO_PIN_15); } /*** end of LedBlinkExit ***/ diff --git a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/main.c b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/main.c index 051d5a92..4dacf974 100644 --- a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/main.c +++ b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/main.c @@ -97,14 +97,15 @@ static void Init(void) static void SystemClock_Config(void) { /* Set flash latency. */ - LL_FLASH_SetLatency(LL_FLASH_LATENCY_2); + LL_FLASH_SetLatency(LL_FLASH_LATENCY_1); /* Verify flash latency setting. */ - if(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_2) + if(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_1) { /* Error setting flash latency. */ ASSERT_RT(BLT_FALSE); } +#if 0 /* Enable the HSE clock. */ LL_RCC_HSE_Enable(); @@ -113,9 +114,10 @@ static void SystemClock_Config(void) { ; } +#endif /* Configure and enable the PLL. */ - LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9); + LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI_DIV_2, LL_RCC_PLL_MUL_9); LL_RCC_PLL_Enable(); /* Wait till PLL is ready */ @@ -124,7 +126,7 @@ static void SystemClock_Config(void) ; } LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); - LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2); + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); @@ -172,12 +174,12 @@ void HAL_MspInit(void) #endif /* Configure GPIO pin for the LED. */ - GPIO_InitStruct.Pin = LL_GPIO_PIN_12; + GPIO_InitStruct.Pin = LL_GPIO_PIN_15; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; - LL_GPIO_Init(GPIOC, &GPIO_InitStruct); - LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_12); + LL_GPIO_Init(GPIOB, &GPIO_InitStruct); + LL_GPIO_SetOutputPin(GPIOB, LL_GPIO_PIN_12); /* Configure GPIO pin for (optional) backdoor entry input. */ GPIO_InitStruct.Pin = LL_GPIO_PIN_0; diff --git a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/makefile b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/makefile index 41d06fc5..fcb3aa33 100644 --- a/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/makefile +++ b/Target/Demo/ARMCM3_STM32F1_sysmocom_rfdsatt_GCC/Boot/makefile @@ -28,7 +28,7 @@ SHELL = sh #|--------------------------------------------------------------------------------------| #| Configure project name | #|--------------------------------------------------------------------------------------| -PROJ_NAME=openblt_olimex_stm32p103 +PROJ_NAME=openblt_sysmocom_rfdsatt #|--------------------------------------------------------------------------------------| @@ -140,6 +140,7 @@ all: $(BIN_PATH)/$(PROJ_NAME).srec $(BIN_PATH)/$(PROJ_NAME).srec : $(BIN_PATH)/$(PROJ_NAME).elf @$(OC) $< $(OFLAGS) $@ @$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map + @$(OC) -O binary $^ $(BIN_PATH)/$(PROJ_NAME).bin @echo +++ Summary of memory consumption: @$(SZ) $(SZFLAGS) $< @echo +++ Build complete [$(notdir $@)]