Merge branch 'Ralim:dev' into translation_update
This commit is contained in:
2
.github/workflows/push.yml
vendored
2
.github/workflows/push.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies (apk)
|
- name: Install dependencies (apk)
|
||||||
run: apk add --no-cache gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf newlib-arm-none-eabi findutils python3 py3-pip make git bash
|
run: apk add --no-cache gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf newlib-arm-none-eabi findutils python3 py3-pip make git musl-dev clang bash clang-extra-tools
|
||||||
|
|
||||||
- name: Install dependencies (python)
|
- name: Install dependencies (python)
|
||||||
run: python3 -m pip install bdflib
|
run: python3 -m pip install bdflib
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Erase the flash, then save the buffer. Returns 1 if worked
|
// Erase the flash, then save the buffer. Returns 1 if worked
|
||||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length);
|
void flash_save_buffer(const uint8_t *buffer, const uint16_t length);
|
||||||
|
|
||||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length);
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
||||||
|
|
||||||
|
|
||||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||||
FLASH_EraseInitTypeDef pEraseInit;
|
FLASH_EraseInitTypeDef pEraseInit;
|
||||||
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||||
pEraseInit.Banks = FLASH_BANK_1;
|
pEraseInit.Banks = FLASH_BANK_1;
|
||||||
@@ -33,10 +33,9 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
|||||||
HAL_FLASH_Unlock();
|
HAL_FLASH_Unlock();
|
||||||
for (uint16_t i = 0; i < (length / 2); i++) {
|
for (uint16_t i = 0; i < (length / 2); i++) {
|
||||||
resetWatchdog();
|
resetWatchdog();
|
||||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint32_t)), data[i]);
|
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint16_t)), data[i]);
|
||||||
}
|
}
|
||||||
HAL_FLASH_Lock();
|
HAL_FLASH_Lock();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
|
||||||
|
|||||||
@@ -278,8 +278,8 @@ typedef struct {
|
|||||||
#define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ1_4))
|
#define ADC_CHANNEL_16 ((uint32_t)(ADC_SQR3_SQ1_4))
|
||||||
#define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_0))
|
#define ADC_CHANNEL_17 ((uint32_t)(ADC_SQR3_SQ1_4 | ADC_SQR3_SQ1_0))
|
||||||
|
|
||||||
#define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16 /* ADC internal channel (no connection on device pin) */
|
// #define ADC_CHANNEL_TEMPSENSOR ADC_CHANNEL_16 /* ADC internal channel (no connection on device pin) */
|
||||||
#define ADC_CHANNEL_VREFINT ADC_CHANNEL_17 /* ADC internal channel (no connection on device pin) */
|
// #define ADC_CHANNEL_VREFINT ADC_CHANNEL_17 /* ADC internal channel (no connection on device pin) */
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -812,10 +812,6 @@ uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef *hadc);
|
|||||||
|
|
||||||
/* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */
|
/* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption and DMA) */
|
||||||
void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc);
|
void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc);
|
||||||
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc);
|
|
||||||
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc);
|
|
||||||
void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef *hadc);
|
|
||||||
void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -852,8 +848,6 @@ HAL_StatusTypeDef ADC_Enable(ADC_HandleTypeDef *hadc);
|
|||||||
HAL_StatusTypeDef ADC_ConversionStop_Disable(ADC_HandleTypeDef *hadc);
|
HAL_StatusTypeDef ADC_ConversionStop_Disable(ADC_HandleTypeDef *hadc);
|
||||||
void ADC_StabilizationTime(uint32_t DelayUs);
|
void ADC_StabilizationTime(uint32_t DelayUs);
|
||||||
void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma);
|
void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma);
|
||||||
void ADC_DMAHalfConvCplt(DMA_HandleTypeDef *hdma);
|
|
||||||
void ADC_DMAError(DMA_HandleTypeDef *hdma);
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -232,8 +232,8 @@ typedef struct {
|
|||||||
/** @defgroup I2C_addressing_mode I2C addressing mode
|
/** @defgroup I2C_addressing_mode I2C addressing mode
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_ADDRESSINGMODE_7BIT 0x00004000U
|
#define I2C_ADDRESSINGMODE_7BIT 0x00004000U
|
||||||
#define I2C_ADDRESSINGMODE_10BIT (I2C_OAR1_ADDMODE | 0x00004000U)
|
// #define I2C_ADDRESSINGMODE_10BIT (I2C_OAR1_ADDMODE | 0x00004000U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
@@ -307,17 +307,17 @@ typedef struct {
|
|||||||
/** @defgroup I2C_Flag_definition I2C Flag definition
|
/** @defgroup I2C_Flag_definition I2C Flag definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define I2C_FLAG_SMBALERT 0x00018000U
|
#define I2C_FLAG_SMBALERT 0x00018000U
|
||||||
#define I2C_FLAG_TIMEOUT 0x00014000U
|
#define I2C_FLAG_TIMEOUT 0x00014000U
|
||||||
#define I2C_FLAG_PECERR 0x00011000U
|
#define I2C_FLAG_PECERR 0x00011000U
|
||||||
#define I2C_FLAG_OVR 0x00010800U
|
#define I2C_FLAG_OVR 0x00010800U
|
||||||
#define I2C_FLAG_AF 0x00010400U
|
#define I2C_FLAG_AF 0x00010400U
|
||||||
#define I2C_FLAG_ARLO 0x00010200U
|
#define I2C_FLAG_ARLO 0x00010200U
|
||||||
#define I2C_FLAG_BERR 0x00010100U
|
#define I2C_FLAG_BERR 0x00010100U
|
||||||
#define I2C_FLAG_TXE 0x00010080U
|
#define I2C_FLAG_TXE 0x00010080U
|
||||||
#define I2C_FLAG_RXNE 0x00010040U
|
#define I2C_FLAG_RXNE 0x00010040U
|
||||||
#define I2C_FLAG_STOPF 0x00010010U
|
#define I2C_FLAG_STOPF 0x00010010U
|
||||||
#define I2C_FLAG_ADD10 0x00010008U
|
// #define I2C_FLAG_ADD10 0x00010008U
|
||||||
#define I2C_FLAG_BTF 0x00010004U
|
#define I2C_FLAG_BTF 0x00010004U
|
||||||
#define I2C_FLAG_ADDR 0x00010002U
|
#define I2C_FLAG_ADDR 0x00010002U
|
||||||
#define I2C_FLAG_SB 0x00010001U
|
#define I2C_FLAG_SB 0x00010001U
|
||||||
|
|||||||
@@ -1194,11 +1194,6 @@ HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, ui
|
|||||||
/* Set the DMA transfer complete callback */
|
/* Set the DMA transfer complete callback */
|
||||||
hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
|
hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
|
||||||
|
|
||||||
/* Set the DMA half transfer complete callback */
|
|
||||||
hadc->DMA_Handle->XferHalfCpltCallback = ADC_DMAHalfConvCplt;
|
|
||||||
|
|
||||||
/* Set the DMA error callback */
|
|
||||||
hadc->DMA_Handle->XferErrorCallback = ADC_DMAError;
|
|
||||||
|
|
||||||
/* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
|
/* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
|
||||||
/* start (in case of SW start): */
|
/* start (in case of SW start): */
|
||||||
@@ -1357,8 +1352,6 @@ void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conversion complete callback */
|
|
||||||
HAL_ADC_ConvCpltCallback(hadc);
|
|
||||||
|
|
||||||
/* Clear regular group conversion flag */
|
/* Clear regular group conversion flag */
|
||||||
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_STRT | ADC_FLAG_EOC);
|
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_STRT | ADC_FLAG_EOC);
|
||||||
@@ -1401,73 +1394,10 @@ void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========== Check Analog watchdog flags ========== */
|
|
||||||
if (__HAL_ADC_GET_IT_SOURCE(hadc, ADC_IT_AWD)) {
|
|
||||||
if (__HAL_ADC_GET_FLAG(hadc, ADC_FLAG_AWD)) {
|
|
||||||
/* Set ADC state */
|
|
||||||
SET_BIT(hadc->State, HAL_ADC_STATE_AWD1);
|
|
||||||
|
|
||||||
/* Level out of window callback */
|
|
||||||
HAL_ADC_LevelOutOfWindowCallback(hadc);
|
|
||||||
|
|
||||||
/* Clear the ADC analog watchdog flag */
|
|
||||||
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_AWD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Conversion complete callback in non blocking mode
|
|
||||||
* @param hadc: ADC handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__weak void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc) {
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
|
||||||
UNUSED(hadc);
|
|
||||||
/* NOTE : This function should not be modified. When the callback is needed,
|
|
||||||
function HAL_ADC_ConvCpltCallback must be implemented in the user file.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Conversion DMA half-transfer callback in non blocking mode
|
|
||||||
* @param hadc: ADC handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__weak void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc) {
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
|
||||||
UNUSED(hadc);
|
|
||||||
/* NOTE : This function should not be modified. When the callback is needed,
|
|
||||||
function HAL_ADC_ConvHalfCpltCallback must be implemented in the user file.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Analog watchdog callback in non blocking mode.
|
|
||||||
* @param hadc: ADC handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__weak void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef *hadc) {
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
|
||||||
UNUSED(hadc);
|
|
||||||
/* NOTE : This function should not be modified. When the callback is needed,
|
|
||||||
function HAL_ADC_LevelOutOfWindowCallback must be implemented in the user file.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ADC error callback in non blocking mode
|
|
||||||
* (ADC conversion with interruption or transfer by DMA)
|
|
||||||
* @param hadc: ADC handle
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
__weak void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc) {
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
|
||||||
UNUSED(hadc);
|
|
||||||
/* NOTE : This function should not be modified. When the callback is needed,
|
|
||||||
function HAL_ADC_ErrorCallback must be implemented in the user file.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
@@ -1509,7 +1439,6 @@ __weak void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc) {
|
|||||||
*/
|
*/
|
||||||
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef *hadc, ADC_ChannelConfTypeDef *sConfig) {
|
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef *hadc, ADC_ChannelConfTypeDef *sConfig) {
|
||||||
HAL_StatusTypeDef tmp_hal_status = HAL_OK;
|
HAL_StatusTypeDef tmp_hal_status = HAL_OK;
|
||||||
__IO uint32_t wait_loop_index = 0U;
|
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||||
@@ -1543,32 +1472,7 @@ HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef *hadc, ADC_ChannelConf
|
|||||||
MODIFY_REG(hadc->Instance->SMPR2, ADC_SMPR2(ADC_SMPR2_SMP0, sConfig->Channel), ADC_SMPR2(sConfig->SamplingTime, sConfig->Channel));
|
MODIFY_REG(hadc->Instance->SMPR2, ADC_SMPR2(ADC_SMPR2_SMP0, sConfig->Channel), ADC_SMPR2(sConfig->SamplingTime, sConfig->Channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If ADC1 Channel_16 or Channel_17 is selected, enable Temperature sensor */
|
|
||||||
/* and VREFINT measurement path. */
|
|
||||||
if ((sConfig->Channel == ADC_CHANNEL_TEMPSENSOR) || (sConfig->Channel == ADC_CHANNEL_VREFINT)) {
|
|
||||||
/* For STM32F1 devices with several ADC: Only ADC1 can access internal */
|
|
||||||
/* measurement channels (VrefInt/TempSensor). If these channels are */
|
|
||||||
/* intended to be set on other ADC instances, an error is reported. */
|
|
||||||
if (hadc->Instance == ADC1) {
|
|
||||||
if (READ_BIT(hadc->Instance->CR2, ADC_CR2_TSVREFE) == RESET) {
|
|
||||||
SET_BIT(hadc->Instance->CR2, ADC_CR2_TSVREFE);
|
|
||||||
|
|
||||||
if ((sConfig->Channel == ADC_CHANNEL_TEMPSENSOR)) {
|
|
||||||
/* Delay for temperature sensor stabilization time */
|
|
||||||
/* Compute number of CPU cycles to wait for */
|
|
||||||
wait_loop_index = (ADC_TEMPSENSOR_DELAY_US * (SystemCoreClock / 1000000U));
|
|
||||||
while (wait_loop_index != 0U) {
|
|
||||||
wait_loop_index--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Update ADC state machine to error */
|
|
||||||
SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_CONFIG);
|
|
||||||
|
|
||||||
tmp_hal_status = HAL_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process unlocked */
|
/* Process unlocked */
|
||||||
__HAL_UNLOCK(hadc);
|
__HAL_UNLOCK(hadc);
|
||||||
@@ -1802,45 +1706,16 @@ void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conversion complete callback */
|
|
||||||
HAL_ADC_ConvCpltCallback(hadc);
|
|
||||||
} else {
|
} else {
|
||||||
/* Call DMA error callback */
|
/* Call DMA error callback */
|
||||||
hadc->DMA_Handle->XferErrorCallback(hdma);
|
hadc->DMA_Handle->XferErrorCallback(hdma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DMA half transfer complete callback.
|
|
||||||
* @param hdma: pointer to DMA handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ADC_DMAHalfConvCplt(DMA_HandleTypeDef *hdma) {
|
|
||||||
/* Retrieve ADC handle corresponding to current DMA handle */
|
|
||||||
ADC_HandleTypeDef *hadc = (ADC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
|
|
||||||
|
|
||||||
/* Half conversion callback */
|
|
||||||
HAL_ADC_ConvHalfCpltCallback(hadc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DMA error callback
|
|
||||||
* @param hdma: pointer to DMA handle.
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void ADC_DMAError(DMA_HandleTypeDef *hdma) {
|
|
||||||
/* Retrieve ADC handle corresponding to current DMA handle */
|
|
||||||
ADC_HandleTypeDef *hadc = (ADC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
|
|
||||||
|
|
||||||
/* Set ADC state */
|
|
||||||
SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_DMA);
|
|
||||||
|
|
||||||
/* Set ADC error code to DMA error */
|
|
||||||
SET_BIT(hadc->ErrorCode, HAL_ADC_ERROR_DMA);
|
|
||||||
|
|
||||||
/* Error callback */
|
|
||||||
HAL_ADC_ErrorCallback(hadc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|||||||
@@ -661,11 +661,6 @@ HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef *hadc, uint32_t
|
|||||||
/* Set the DMA transfer complete callback */
|
/* Set the DMA transfer complete callback */
|
||||||
hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
|
hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
|
||||||
|
|
||||||
/* Set the DMA half transfer complete callback */
|
|
||||||
hadc->DMA_Handle->XferHalfCpltCallback = ADC_DMAHalfConvCplt;
|
|
||||||
|
|
||||||
/* Set the DMA error callback */
|
|
||||||
hadc->DMA_Handle->XferErrorCallback = ADC_DMAError;
|
|
||||||
|
|
||||||
/* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
|
/* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
|
||||||
/* start (in case of SW start): */
|
/* start (in case of SW start): */
|
||||||
@@ -905,7 +900,6 @@ __weak void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc) {
|
|||||||
*/
|
*/
|
||||||
HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef *hadc, ADC_InjectionConfTypeDef *sConfigInjected) {
|
HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef *hadc, ADC_InjectionConfTypeDef *sConfigInjected) {
|
||||||
HAL_StatusTypeDef tmp_hal_status = HAL_OK;
|
HAL_StatusTypeDef tmp_hal_status = HAL_OK;
|
||||||
__IO uint32_t wait_loop_index = 0U;
|
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||||
@@ -1034,11 +1028,8 @@ HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef *hadc, ADC_I
|
|||||||
MODIFY_REG(hadc->Instance->SMPR2, ADC_SMPR2(ADC_SMPR2_SMP0, sConfigInjected->InjectedChannel), ADC_SMPR2(sConfigInjected->InjectedSamplingTime, sConfigInjected->InjectedChannel));
|
MODIFY_REG(hadc->Instance->SMPR2, ADC_SMPR2(ADC_SMPR2_SMP0, sConfigInjected->InjectedChannel), ADC_SMPR2(sConfigInjected->InjectedSamplingTime, sConfigInjected->InjectedChannel));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If ADC1 InjectedChannel_16 or InjectedChannel_17 is selected, enable Temperature sensor */
|
|
||||||
/* and VREFINT measurement path. */
|
|
||||||
if ((sConfigInjected->InjectedChannel == ADC_CHANNEL_TEMPSENSOR) || (sConfigInjected->InjectedChannel == ADC_CHANNEL_VREFINT)) {
|
|
||||||
SET_BIT(hadc->Instance->CR2, ADC_CR2_TSVREFE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Configure the offset: offset enable/disable, InjectedChannel, offset value */
|
/* Configure the offset: offset enable/disable, InjectedChannel, offset value */
|
||||||
switch (sConfigInjected->InjectedRank) {
|
switch (sConfigInjected->InjectedRank) {
|
||||||
@@ -1060,33 +1051,7 @@ HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef *hadc, ADC_I
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If ADC1 Channel_16 or Channel_17 is selected, enable Temperature sensor */
|
|
||||||
/* and VREFINT measurement path. */
|
|
||||||
if ((sConfigInjected->InjectedChannel == ADC_CHANNEL_TEMPSENSOR) || (sConfigInjected->InjectedChannel == ADC_CHANNEL_VREFINT)) {
|
|
||||||
/* For STM32F1 devices with several ADC: Only ADC1 can access internal */
|
|
||||||
/* measurement channels (VrefInt/TempSensor). If these channels are */
|
|
||||||
/* intended to be set on other ADC instances, an error is reported. */
|
|
||||||
if (hadc->Instance == ADC1) {
|
|
||||||
if (READ_BIT(hadc->Instance->CR2, ADC_CR2_TSVREFE) == RESET) {
|
|
||||||
SET_BIT(hadc->Instance->CR2, ADC_CR2_TSVREFE);
|
|
||||||
|
|
||||||
if ((sConfigInjected->InjectedChannel == ADC_CHANNEL_TEMPSENSOR)) {
|
|
||||||
/* Delay for temperature sensor stabilization time */
|
|
||||||
/* Compute number of CPU cycles to wait for */
|
|
||||||
wait_loop_index = (ADC_TEMPSENSOR_DELAY_US * (SystemCoreClock / 1000000U));
|
|
||||||
while (wait_loop_index != 0U) {
|
|
||||||
wait_loop_index--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Update ADC state machine to error */
|
|
||||||
SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_CONFIG);
|
|
||||||
|
|
||||||
tmp_hal_status = HAL_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process unlocked */
|
/* Process unlocked */
|
||||||
__HAL_UNLOCK(hadc);
|
__HAL_UNLOCK(hadc);
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ static HAL_StatusTypeDef I2C_MasterTransmit_BTF(I2C_HandleTypeDef *hi2c);
|
|||||||
static HAL_StatusTypeDef I2C_MasterReceive_RXNE(I2C_HandleTypeDef *hi2c);
|
static HAL_StatusTypeDef I2C_MasterReceive_RXNE(I2C_HandleTypeDef *hi2c);
|
||||||
static HAL_StatusTypeDef I2C_MasterReceive_BTF(I2C_HandleTypeDef *hi2c);
|
static HAL_StatusTypeDef I2C_MasterReceive_BTF(I2C_HandleTypeDef *hi2c);
|
||||||
static HAL_StatusTypeDef I2C_Master_SB(I2C_HandleTypeDef *hi2c);
|
static HAL_StatusTypeDef I2C_Master_SB(I2C_HandleTypeDef *hi2c);
|
||||||
static HAL_StatusTypeDef I2C_Master_ADD10(I2C_HandleTypeDef *hi2c);
|
|
||||||
static HAL_StatusTypeDef I2C_Master_ADDR(I2C_HandleTypeDef *hi2c);
|
static HAL_StatusTypeDef I2C_Master_ADDR(I2C_HandleTypeDef *hi2c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -957,16 +956,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData
|
|||||||
/* Clear ADDR flag */
|
/* Clear ADDR flag */
|
||||||
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
||||||
|
|
||||||
/* If 10bit addressing mode is selected */
|
|
||||||
if (hi2c->Init.AddressingMode == I2C_ADDRESSINGMODE_10BIT) {
|
|
||||||
/* Wait until ADDR flag is set */
|
|
||||||
if (I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, RESET, Timeout, tickstart) != HAL_OK) {
|
|
||||||
return HAL_TIMEOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear ADDR flag */
|
|
||||||
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (hi2c->XferSize > 0U) {
|
while (hi2c->XferSize > 0U) {
|
||||||
/* Wait until TXE flag is set */
|
/* Wait until TXE flag is set */
|
||||||
@@ -3083,10 +3073,6 @@ void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c) {
|
|||||||
if (((sr1itflags & I2C_FLAG_SB) != RESET) && ((itsources & I2C_IT_EVT) != RESET)) {
|
if (((sr1itflags & I2C_FLAG_SB) != RESET) && ((itsources & I2C_IT_EVT) != RESET)) {
|
||||||
I2C_Master_SB(hi2c);
|
I2C_Master_SB(hi2c);
|
||||||
}
|
}
|
||||||
/* ADD10 Set -------------------------------------------------------------*/
|
|
||||||
else if (((sr1itflags & I2C_FLAG_ADD10) != RESET) && ((itsources & I2C_IT_EVT) != RESET)) {
|
|
||||||
I2C_Master_ADD10(hi2c);
|
|
||||||
}
|
|
||||||
/* ADDR Set --------------------------------------------------------------*/
|
/* ADDR Set --------------------------------------------------------------*/
|
||||||
else if (((sr1itflags & I2C_FLAG_ADDR) != RESET) && ((itsources & I2C_IT_EVT) != RESET)) {
|
else if (((sr1itflags & I2C_FLAG_ADDR) != RESET) && ((itsources & I2C_IT_EVT) != RESET)) {
|
||||||
I2C_Master_ADDR(hi2c);
|
I2C_Master_ADDR(hi2c);
|
||||||
@@ -3731,18 +3717,6 @@ static HAL_StatusTypeDef I2C_Master_SB(I2C_HandleTypeDef *hi2c) {
|
|||||||
return HAL_OK;
|
return HAL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Handle ADD10 flag for Master
|
|
||||||
* @param hi2c Pointer to a I2C_HandleTypeDef structure that contains
|
|
||||||
* the configuration information for I2C module
|
|
||||||
* @retval HAL status
|
|
||||||
*/
|
|
||||||
static HAL_StatusTypeDef I2C_Master_ADD10(I2C_HandleTypeDef *hi2c) {
|
|
||||||
/* Send slave address */
|
|
||||||
hi2c->Instance->DR = I2C_10BIT_ADDRESS(hi2c->Devaddress);
|
|
||||||
|
|
||||||
return HAL_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handle ADDR flag for Master
|
* @brief Handle ADDR flag for Master
|
||||||
@@ -3760,14 +3734,6 @@ static HAL_StatusTypeDef I2C_Master_ADDR(I2C_HandleTypeDef *hi2c) {
|
|||||||
if ((hi2c->EventCount == 0U) && (CurrentMode == HAL_I2C_MODE_MEM)) {
|
if ((hi2c->EventCount == 0U) && (CurrentMode == HAL_I2C_MODE_MEM)) {
|
||||||
/* Clear ADDR flag */
|
/* Clear ADDR flag */
|
||||||
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
||||||
} else if ((hi2c->EventCount == 0U) && (hi2c->Init.AddressingMode == I2C_ADDRESSINGMODE_10BIT)) {
|
|
||||||
/* Clear ADDR flag */
|
|
||||||
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
|
||||||
|
|
||||||
/* Generate Restart */
|
|
||||||
hi2c->Instance->CR1 |= I2C_CR1_START;
|
|
||||||
|
|
||||||
hi2c->EventCount++;
|
|
||||||
} else {
|
} else {
|
||||||
if (hi2c->XferCount == 0U) {
|
if (hi2c->XferCount == 0U) {
|
||||||
/* Clear ADDR flag */
|
/* Clear ADDR flag */
|
||||||
@@ -3996,22 +3962,8 @@ static HAL_StatusTypeDef I2C_MasterRequestWrite(I2C_HandleTypeDef *hi2c, uint16_
|
|||||||
if (hi2c->Init.AddressingMode == I2C_ADDRESSINGMODE_7BIT) {
|
if (hi2c->Init.AddressingMode == I2C_ADDRESSINGMODE_7BIT) {
|
||||||
/* Send slave address */
|
/* Send slave address */
|
||||||
hi2c->Instance->DR = I2C_7BIT_ADD_WRITE(DevAddress);
|
hi2c->Instance->DR = I2C_7BIT_ADD_WRITE(DevAddress);
|
||||||
} else {
|
|
||||||
/* Send header of slave address */
|
|
||||||
hi2c->Instance->DR = I2C_10BIT_HEADER_WRITE(DevAddress);
|
|
||||||
|
|
||||||
/* Wait until ADD10 flag is set */
|
|
||||||
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADD10, Timeout, Tickstart) != HAL_OK) {
|
|
||||||
if (hi2c->ErrorCode == HAL_I2C_ERROR_AF) {
|
|
||||||
return HAL_ERROR;
|
|
||||||
} else {
|
|
||||||
return HAL_TIMEOUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send slave address */
|
|
||||||
hi2c->Instance->DR = I2C_10BIT_ADDRESS(DevAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Wait until ADDR flag is set */
|
/* Wait until ADDR flag is set */
|
||||||
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, Timeout, Tickstart) != HAL_OK) {
|
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, Timeout, Tickstart) != HAL_OK) {
|
||||||
@@ -4059,45 +4011,8 @@ static HAL_StatusTypeDef I2C_MasterRequestRead(I2C_HandleTypeDef *hi2c, uint16_t
|
|||||||
if (hi2c->Init.AddressingMode == I2C_ADDRESSINGMODE_7BIT) {
|
if (hi2c->Init.AddressingMode == I2C_ADDRESSINGMODE_7BIT) {
|
||||||
/* Send slave address */
|
/* Send slave address */
|
||||||
hi2c->Instance->DR = I2C_7BIT_ADD_READ(DevAddress);
|
hi2c->Instance->DR = I2C_7BIT_ADD_READ(DevAddress);
|
||||||
} else {
|
|
||||||
/* Send header of slave address */
|
|
||||||
hi2c->Instance->DR = I2C_10BIT_HEADER_WRITE(DevAddress);
|
|
||||||
|
|
||||||
/* Wait until ADD10 flag is set */
|
|
||||||
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADD10, Timeout, Tickstart) != HAL_OK) {
|
|
||||||
if (hi2c->ErrorCode == HAL_I2C_ERROR_AF) {
|
|
||||||
return HAL_ERROR;
|
|
||||||
} else {
|
|
||||||
return HAL_TIMEOUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send slave address */
|
|
||||||
hi2c->Instance->DR = I2C_10BIT_ADDRESS(DevAddress);
|
|
||||||
|
|
||||||
/* Wait until ADDR flag is set */
|
|
||||||
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, Timeout, Tickstart) != HAL_OK) {
|
|
||||||
if (hi2c->ErrorCode == HAL_I2C_ERROR_AF) {
|
|
||||||
return HAL_ERROR;
|
|
||||||
} else {
|
|
||||||
return HAL_TIMEOUT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear ADDR flag */
|
|
||||||
__HAL_I2C_CLEAR_ADDRFLAG(hi2c);
|
|
||||||
|
|
||||||
/* Generate Restart */
|
|
||||||
hi2c->Instance->CR1 |= I2C_CR1_START;
|
|
||||||
|
|
||||||
/* Wait until SB flag is set */
|
|
||||||
if (I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_SB, RESET, Timeout, Tickstart) != HAL_OK) {
|
|
||||||
return HAL_TIMEOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send header of slave address */
|
|
||||||
hi2c->Instance->DR = I2C_10BIT_HEADER_READ(DevAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Wait until ADDR flag is set */
|
/* Wait until ADDR flag is set */
|
||||||
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, Timeout, Tickstart) != HAL_OK) {
|
if (I2C_WaitOnMasterAddressFlagUntilTimeout(hi2c, I2C_FLAG_ADDR, Timeout, Tickstart) != HAL_OK) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))
|
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))
|
||||||
|
|
||||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||||
FLASH_EraseInitTypeDef pEraseInit;
|
FLASH_EraseInitTypeDef pEraseInit;
|
||||||
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;
|
||||||
pEraseInit.Banks = FLASH_BANK_1;
|
pEraseInit.Banks = FLASH_BANK_1;
|
||||||
@@ -32,10 +32,10 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
|||||||
HAL_FLASH_Unlock();
|
HAL_FLASH_Unlock();
|
||||||
for (uint16_t i = 0; i < (length / 2); i++) {
|
for (uint16_t i = 0; i < (length / 2); i++) {
|
||||||
resetWatchdog();
|
resetWatchdog();
|
||||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint32_t)), data[i]);
|
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint16_t)), data[i]);
|
||||||
}
|
}
|
||||||
HAL_FLASH_Lock();
|
HAL_FLASH_Lock();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); }
|
||||||
|
|||||||
@@ -189,24 +189,27 @@ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxC
|
|||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvTaskExitError(void) {
|
static void prvTaskExitError(void) {
|
||||||
volatile uint32_t ulDummy = 0UL;
|
// volatile uint32_t ulDummy = 0UL;
|
||||||
|
|
||||||
/* A function that implements a task must not exit or attempt to return to
|
// /* A function that implements a task must not exit or attempt to return to
|
||||||
its caller as there is nothing to return to. If a task wants to exit it
|
// its caller as there is nothing to return to. If a task wants to exit it
|
||||||
should instead call vTaskDelete( NULL ).
|
// should instead call vTaskDelete( NULL ).
|
||||||
|
|
||||||
Artificially force an assert() to be triggered if configASSERT() is
|
// Artificially force an assert() to be triggered if configASSERT() is
|
||||||
defined, then stop here so application writers can catch the error. */
|
// defined, then stop here so application writers can catch the error. */
|
||||||
configASSERT(uxCriticalNesting == ~0UL);
|
// configASSERT(uxCriticalNesting == ~0UL);
|
||||||
portDISABLE_INTERRUPTS();
|
// portDISABLE_INTERRUPTS();
|
||||||
while (ulDummy == 0) {
|
// while (ulDummy == 0) {
|
||||||
/* This file calls prvTaskExitError() after the scheduler has been
|
// /* This file calls prvTaskExitError() after the scheduler has been
|
||||||
started to remove a compiler warning about the function being defined
|
// started to remove a compiler warning about the function being defined
|
||||||
but never called. ulDummy is used purely to quieten other warnings
|
// but never called. ulDummy is used purely to quieten other warnings
|
||||||
about code appearing after this function is called - making ulDummy
|
// about code appearing after this function is called - making ulDummy
|
||||||
volatile makes the compiler think the function could return and
|
// volatile makes the compiler think the function could return and
|
||||||
therefore not output an 'unreachable code' warning for code that appears
|
// therefore not output an 'unreachable code' warning for code that appears
|
||||||
after it. */
|
// after it. */
|
||||||
|
// }
|
||||||
|
for(;;){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|||||||
@@ -11,21 +11,6 @@ extern TIM_HandleTypeDef htim1; // used for the systick
|
|||||||
/* Cortex-M3 Processor Interruption and Exception Handlers */
|
/* Cortex-M3 Processor Interruption and Exception Handlers */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
void NMI_Handler(void) {}
|
|
||||||
|
|
||||||
// We have the assembly for a breakpoint trigger here to halt the system when a debugger is connected
|
|
||||||
// Hardfault handler, often a screwup in the code
|
|
||||||
void HardFault_Handler(void) {}
|
|
||||||
|
|
||||||
// Memory management unit had an error
|
|
||||||
void MemManage_Handler(void) {}
|
|
||||||
|
|
||||||
// Prefetcher or busfault occured
|
|
||||||
void BusFault_Handler(void) {}
|
|
||||||
|
|
||||||
void UsageFault_Handler(void) {}
|
|
||||||
|
|
||||||
void DebugMon_Handler(void) {}
|
|
||||||
|
|
||||||
// Systick is used by FreeRTOS tick
|
// Systick is used by FreeRTOS tick
|
||||||
void SysTick_Handler(void) { osSystickHandler(); }
|
void SysTick_Handler(void) { osSystickHandler(); }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
#define FMC_PAGE_SIZE ((uint16_t)0x400U)
|
#define FMC_PAGE_SIZE ((uint16_t)0x400U)
|
||||||
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
||||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||||
|
|
||||||
/* unlock the flash program/erase controller */
|
/* unlock the flash program/erase controller */
|
||||||
fmc_unlock();
|
fmc_unlock();
|
||||||
@@ -32,7 +32,6 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
|||||||
resetWatchdog();
|
resetWatchdog();
|
||||||
}
|
}
|
||||||
fmc_lock();
|
fmc_lock();
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) {
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length) {
|
||||||
|
|||||||
@@ -14,10 +14,9 @@
|
|||||||
|
|
||||||
#define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr
|
#define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr
|
||||||
|
|
||||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||||
BL_Err_Type err = flash_erase(SETTINGS_START_PAGE, FLASH_PAGE_SIZE);
|
BL_Err_Type err = flash_erase(SETTINGS_START_PAGE, FLASH_PAGE_SIZE);
|
||||||
err = flash_write(SETTINGS_START_PAGE, buffer, length);
|
err = flash_write(SETTINGS_START_PAGE, buffer, length);
|
||||||
return err != SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { flash_read(SETTINGS_START_PAGE, buffer, length); }
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { flash_read(SETTINGS_START_PAGE, buffer, length); }
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ S_SRCS := $(shell find $(MINIWARE_STARTUP_DIR) -type f -name '*.S')
|
|||||||
LDSCRIPT=$(MINIWARE_LD_FILE)
|
LDSCRIPT=$(MINIWARE_LD_FILE)
|
||||||
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
||||||
-D ARM_MATH_CM3 \
|
-D ARM_MATH_CM3 \
|
||||||
-D STM32F10X_MD
|
-D STM32F10X_MD -finline-limit=9999999
|
||||||
DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning
|
DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning
|
||||||
DEV_AFLAGS=
|
DEV_AFLAGS=
|
||||||
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
|
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U
|
||||||
@@ -271,7 +271,7 @@ CPUFLAGS= -march=rv32imafc \
|
|||||||
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles \
|
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles \
|
||||||
-DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler -DARCH_RISCV -D__RISCV_FEATURE_MVE=0 -DportUSING_MPU_WRAPPERS=0
|
-DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler -DARCH_RISCV -D__RISCV_FEATURE_MVE=0 -DportUSING_MPU_WRAPPERS=0
|
||||||
# -DBFLB_USE_ROM_DRIVER=1
|
# -DBFLB_USE_ROM_DRIVER=1
|
||||||
DEV_LDFLAGS=-nostartfiles -DDEBUG
|
DEV_LDFLAGS=-nostartfiles
|
||||||
DEV_AFLAGS=
|
DEV_AFLAGS=
|
||||||
DEV_GLOBAL_DEFS=
|
DEV_GLOBAL_DEFS=
|
||||||
#Required to be turned off due to their drivers tripping warnings
|
#Required to be turned off due to their drivers tripping warnings
|
||||||
@@ -313,12 +313,11 @@ $(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o
|
|||||||
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
|
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
|
||||||
|
|
||||||
# code optimisation ------------------------------------------------------------
|
# code optimisation ------------------------------------------------------------
|
||||||
OPTIM=-Os -fshort-wchar -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common
|
OPTIM=-Os -foptimize-strlen -faggressive-loop-optimizations -fdevirtualize-at-ltrans -fmerge-all-constants -fshort-wchar -flto -finline-small-functions -finline-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common -fno-math-errno -ffast-math -ffinite-math-only -fno-signed-zeros -fsingle-precision-constant
|
||||||
|
|
||||||
# global defines ---------------------------------------------------------------
|
# global defines ---------------------------------------------------------------
|
||||||
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
|
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
|
||||||
|
|
||||||
DEBUG=-g3
|
|
||||||
ifdef swd_enable
|
ifdef swd_enable
|
||||||
GLOBAL_DEFINES += -DSWD_ENABLE
|
GLOBAL_DEFINES += -DSWD_ENABLE
|
||||||
endif
|
endif
|
||||||
@@ -400,7 +399,6 @@ CHECKOPTIONS_C= $(CHECKOPTIONS) -Wbad-function-cast
|
|||||||
|
|
||||||
CXXFLAGS=$(DEV_CXXFLAGS) \
|
CXXFLAGS=$(DEV_CXXFLAGS) \
|
||||||
$(CPUFLAGS) \
|
$(CPUFLAGS) \
|
||||||
$(DEBUG) \
|
|
||||||
$(INCLUDES) \
|
$(INCLUDES) \
|
||||||
$(GLOBAL_DEFINES) \
|
$(GLOBAL_DEFINES) \
|
||||||
-D${COMPILER} \
|
-D${COMPILER} \
|
||||||
@@ -419,7 +417,6 @@ CXXFLAGS=$(DEV_CXXFLAGS) \
|
|||||||
|
|
||||||
CFLAGS=$(DEV_CFLAGS) \
|
CFLAGS=$(DEV_CFLAGS) \
|
||||||
$(CPUFLAGS) \
|
$(CPUFLAGS) \
|
||||||
$(DEBUG) \
|
|
||||||
$(INCLUDES) \
|
$(INCLUDES) \
|
||||||
$(CHECKOPTIONS_C) \
|
$(CHECKOPTIONS_C) \
|
||||||
$(GLOBAL_DEFINES) \
|
$(GLOBAL_DEFINES) \
|
||||||
@@ -436,7 +433,6 @@ AFLAGS= $(CPUFLAGS) \
|
|||||||
$(DEV_AFLAGS) \
|
$(DEV_AFLAGS) \
|
||||||
$(GLOBAL_DEFINES) \
|
$(GLOBAL_DEFINES) \
|
||||||
$(OPTIM) \
|
$(OPTIM) \
|
||||||
$(DEBUG) \
|
|
||||||
$(ASM_INC) \
|
$(ASM_INC) \
|
||||||
$(INCLUDES)
|
$(INCLUDES)
|
||||||
|
|
||||||
@@ -476,30 +472,6 @@ firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFIL
|
|||||||
python3 dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
|
python3 dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
|
||||||
|
|
||||||
$(HEXFILE_DIR)/$(model)_%.elf : \
|
$(HEXFILE_DIR)/$(model)_%.elf : \
|
||||||
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
|
|
||||||
$(OUTPUT_DIR)/Core/Gen/Translation.%.o \
|
|
||||||
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
|
||||||
Makefile $(LDSCRIPT)
|
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
|
||||||
@echo Linking $@
|
|
||||||
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
|
|
||||||
$(OUTPUT_DIR)/Core/Gen/Translation.$*.o \
|
|
||||||
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
|
||||||
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
|
|
||||||
|
|
||||||
$(HEXFILE_DIR)/$(model)_string_compressed_%.elf : \
|
|
||||||
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
|
|
||||||
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.%.o \
|
|
||||||
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
|
||||||
Makefile $(LDSCRIPT)
|
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
|
||||||
@echo Linking $@
|
|
||||||
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
|
|
||||||
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.$*.o \
|
|
||||||
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
|
||||||
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
|
|
||||||
|
|
||||||
$(HEXFILE_DIR)/$(model)_font_compressed_%.elf : \
|
|
||||||
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
|
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
|
||||||
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \
|
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \
|
||||||
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
||||||
@@ -511,6 +483,7 @@ $(HEXFILE_DIR)/$(model)_font_compressed_%.elf : \
|
|||||||
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
|
||||||
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
|
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
|
||||||
|
|
||||||
|
|
||||||
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
|
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
@test -d $(@D) || mkdir -p $(@D)
|
||||||
@echo Compiling ${<}
|
@echo Compiling ${<}
|
||||||
@@ -546,12 +519,12 @@ Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle: ..
|
|||||||
$(OUTPUT_DIR)/Core/Gen/translation.files/%.o: Core/Gen/Translation.%.cpp
|
$(OUTPUT_DIR)/Core/Gen/translation.files/%.o: Core/Gen/Translation.%.cpp
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
@test -d $(@D) || mkdir -p $(@D)
|
||||||
@echo Generating $@
|
@echo Generating $@
|
||||||
@$(CPP) -c $(filter-out -flto -g3,$(CXXFLAGS)) $< -o $@
|
@$(CPP) -c $(filter-out -flto ,$(CXXFLAGS)) $< -o $@
|
||||||
|
|
||||||
$(OUTPUT_DIR)/Core/Gen/translation.files/multi.%.o: Core/Gen/Translation_multi.%.cpp
|
$(OUTPUT_DIR)/Core/Gen/translation.files/multi.%.o: Core/Gen/Translation_multi.%.cpp
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
@test -d $(@D) || mkdir -p $(@D)
|
||||||
@echo Generating $@
|
@echo Generating $@
|
||||||
@$(CPP) -c $(filter-out -flto -g3,$(CXXFLAGS)) $< -o $@
|
@$(CPP) -c $(filter-out -flto ,$(CXXFLAGS)) $< -o $@
|
||||||
|
|
||||||
$(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so: Core/brieflz/brieflz.c Core/brieflz/depack.c
|
$(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so: Core/brieflz/brieflz.c Core/brieflz/depack.c
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
@test -d $(@D) || mkdir -p $(@D)
|
||||||
|
|||||||
Reference in New Issue
Block a user