From b2f97933fd0fec21472bf3b04aad77e122c0ed35 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Wed, 13 Dec 2017 22:07:25 +1100 Subject: Making rough Makefile --- workspace/TS100/.gitignore | 3 + workspace/TS100/HAL_Driver/Release_Notes.html | 1515 -------------------- .../TS100/HAL_Driver/STM32F100xE_User_Manual.chm | Bin 8801710 -> 0 bytes .../TS100/HAL_Driver/STM32F103xB_User_Manual.chm | Bin 8544134 -> 0 bytes .../TS100/HAL_Driver/STM32F103xG_User_Manual.chm | Bin 9717860 -> 0 bytes .../TS100/HAL_Driver/STM32F107xC_User_Manual.chm | Bin 9695050 -> 0 bytes .../stm32f1xx_hal_timebase_rtc_alarm_template.c | 307 ---- .../Src/stm32f1xx_hal_timebase_tim_template.c | 184 --- workspace/TS100/Makefile | 219 +++ .../FreeRTOS/Source/portable/MemMang/heap_1.c | 188 --- .../FreeRTOS/Source/portable/MemMang/heap_2.c | 314 ---- .../FreeRTOS/Source/portable/MemMang/heap_3.c | 139 -- .../FreeRTOS/Source/portable/MemMang/heap_5.c | 527 ------- workspace/TS100/src/syscalls.c | 45 - 14 files changed, 222 insertions(+), 3219 deletions(-) delete mode 100644 workspace/TS100/HAL_Driver/Release_Notes.html delete mode 100644 workspace/TS100/HAL_Driver/STM32F100xE_User_Manual.chm delete mode 100644 workspace/TS100/HAL_Driver/STM32F103xB_User_Manual.chm delete mode 100644 workspace/TS100/HAL_Driver/STM32F103xG_User_Manual.chm delete mode 100644 workspace/TS100/HAL_Driver/STM32F107xC_User_Manual.chm delete mode 100644 workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c delete mode 100644 workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_tim_template.c create mode 100644 workspace/TS100/Makefile delete mode 100644 workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_1.c delete mode 100644 workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_2.c delete mode 100644 workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_3.c delete mode 100644 workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_5.c diff --git a/workspace/TS100/.gitignore b/workspace/TS100/.gitignore index ac01e665..1fb2a390 100644 --- a/workspace/TS100/.gitignore +++ b/workspace/TS100/.gitignore @@ -1,2 +1,5 @@ /Debug/ /Release/ +/Hexfile/ +/Objects/ + diff --git a/workspace/TS100/HAL_Driver/Release_Notes.html b/workspace/TS100/HAL_Driver/Release_Notes.html deleted file mode 100644 index b21b32ac..00000000 --- a/workspace/TS100/HAL_Driver/Release_Notes.html +++ /dev/null @@ -1,1515 +0,0 @@ - - - - - - - - - - - - - -Release Notes for STM32F1xx HAL Drivers - - - - - - - - - - -
- -

 

- -
- - - - - -
- - - - - - - -
-

Back to Release page

-
-

Release Notes for STM32F1xx HAL Drivers

-

Copyright - 2016 STMicroelectronics

-

-
-

 

- - - - -
-

Update History

- -

V1.1.1 / 12-May-2017

  • General updates to fix known defects and enhancements implementation
  • HAL update
    • stm32f1xx_hal_conf_template.h fix typo: update to refer to stm32f1xx_hal_mmc.h instead of  stm32f4xx_hal_mmc.h
  • LL SYSTEM update
    • LL_DBGMCU_APB1_GRP1_I2C1_STOP and LL_DBGMCU_APB1_GRP1_I2C2_STOP literals are retarget to an available literals
    • LL_DBGMCU_APB1_GRP1_RTC_STOP literal is not available for all STM32F1 devices
  • HAL MMC update
    • Add missing () to fix compilation warning detected with SW4STM32 when extra feature is enabled.
  • HAL I2C update
    • Update -HAL I2C processes to manage correctly the I2C state to allow the -possibility to call HAL_I2C_Master_Sequential_Receive_IT() followed by -a call HAL_I2C_Master_Sequential_Transmit_IT()

V1.1.0 / 14-April-2017

  • Add Low Layer drivers allowing performance and footprint optimization
    • Low -Layer drivers APIs provide register level programming: require deep -knowledge of peripherals described in STM32F1xx Reference Manuals
    • Low -Layer drivers are available for: ADC, Cortex, CRC, DAC, DMA, EXTI, GPIO, I2C, IWDG, PWR, RCC, RTC, SPI, TIM, -USART, WWDG peripherals and additionnal Low Level Bus, System and -Utilities APIs.
    • Low Layer drivers APIs are implemented as static inline function in new Inc/stm32f1xx_ll_ppp.h files for PPP peripherals, there is no configuration file and each stm32f1xx_ll_ppp.h file must be included in user code.
  • Add new HAL MMC driver
  • General updates to fix known defects and enhancements implementation
  • - -Enhance HAL delay and time base implementation:
    • Add -new drivers stm32f1xx_hal_timebase_rtc_alarm_template.c and -stm32f1xx_hal_timebase_tim_template.c which override the native -HAL time base functions (defined as weak) to either use the RTC/TIM as time -base tick source. For more details about the usage of these drivers, -please refer to HAL\HAL_TimeBase_RTC  and HAL\HAL_TimeBase_TIM examples and FreeRTOS-based applications
  • Fix extra warnings with GCC compiler
  • HAL drivers clean up: update 'uint32_t' cast with 'U'
  • Update to used the new defined Bit_Pos CMSIS defines insetad of POSITION_VAL() macro
  • Update HAL -weak empty callbacks to prevent unused argument compilation warnings with some -compilers by calling the following line: -
    • UNUSED(hppp);
  • STM32Fxxx_User_Manual.chm files regenerated for HAL V1.1.0
  • The following changes done on the HAL drivers require an update on the application code based on older HAL versions
    • HAL UART, USART, IRDA, SMARTCARD, SPI, I2C (referenced as PPP here below) drivers
      • Add PPP error management during DMA process. This requires the following updates on user application:
        • Configure and enable the PPP IRQ in HAL_PPP_MspInit() function
        • In stm32f1xx_it.c file, PPP_IRQHandler() function: add a call to HAL_PPP_IRQHandler() function
        • Add customize the Error Callback API: HAL_PPP_ErrorCallback()
    • HAL SD driver:
      • Overall rework of the driver for a more efficient implementation
        • Modify initialization API and structures
        • Modify Read / Write sequences: separate transfer process and SD Cards state management 
        • Adding interrupt mode for Read / Write operations
        • Update the HAL_SD_IRQHandler function by optimizing the management of interrupt errors
      • Refer to the following example to identify the changes: BSP example and USB_Device/MSC_Standalone application
    • HAL NAND driver:
      • Modify NAND_AddressTypeDef, NAND_DeviceConfigTypeDef and NAND_HandleTypeDef structures fields
      • Add new HAL_NAND_ConfigDevice API
    • HAL CEC driver:  Overall driver rework with compatibility break versus previous HAL version
      • Remove HAL CEC polling Process functions: HAL_CEC_Transmit() and HAL_CEC_Receive()
      • Remove -HAL CEC receive interrupt process function HAL_CEC_Receive_IT() -and enable the "receive"  mode during the Init phase
      • Rename HAL_CEC_GetReceivedFrameSize() funtion to HAL_CEC_GetLastReceivedFrameSize()
      • Add new HAL APIs: HAL_CEC_SetDeviceAddress() and HAL_CEC_ChangeRxBuffer()
      • Remove the 'InitiatorAddress' -field from the CEC_InitTypeDef structure and manage -it as a parameter in the HAL_CEC_Transmit_IT() function
      • Add new parameter 'RxFrameSize' in HAL_CEC_RxCpltCallback() function
      • Move CEC Rx buffer pointer from CEC_HandleTypeDef structure to CEC_InitTypeDef structure
    • HAL IWDG driver: rework overall driver for better implementation
      • Remove HAL_IWDG_Start(), HAL_IWDG_MspInit() and HAL_IWDG_GetState() APIs
    • HAL WWDG driver: rework overall driver for better implementation
      • Remove HAL_WWDG_Start(), HAL_WWDG_Start_IT(), HAL_WWDG_MspDeInit() and HAL_WWDG_GetState() APIs 
      • Update the HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg, uint32_t counter)  function and API  by removing the  "counter" parameter
  • HAL GENERIC update
    • Modifiy default HAL_Delay implementation to guarantee minimum delay 
    • stm32f1xx_hal_conf_template.h
      • Add new define LSI_VALUE
      • Add new define USE_SPI_CRC for code cleanup when the CRC calculation is disabled.
  • HAL CORTEX update
    • Move HAL_MPU_Disable() and HAL_MPU_Enable() from stm32f4xx_hal_cortex.h to stm32f4xx_hal_cortex.c
    • Clear the whole MPU control register in HAL_MPU_Disable() API
  • HAL FLASH update
    • HAL_FLASH_OB_Launch(): fix static code analyzer warning: The removed code will not execute under any circumstances
  • HAL GPIO update
    • Update IS_GPIO_PIN() macro implementation to be more safe
    • Update remap macros implementation to use CLEAR_BIT()/SET_BIT() macros instead of  MODIFY_REG() macro.
  • HAL RCC update
    • Update LSI workaround delay to use CPU cycles instead of systick
    • Move LSI_VALUE define from RCC HAL driver to stm32f1xx_hal_conf.h file
    • Adjust defined PLL MUL values in aPLLMULFactorTable[]
  • HAL ADC update
    • HAL_ADCEx_MultiModeStart_DMA()  and HAL_ADCEx_MultiModeStop_DMA() API's update to fix code static analyzer warning: Redundant Condition / Unreachable Computation
  • HAL DMA update
    • HAL_DMA_Init(): update to check compatibility between FIFO threshold level and size of the memory burst 
    • Global driver code optimization to reduce memory footprint 
    • New APIs HAL_DMA_RegisterCallback() and HAL_DMA_UnRegisterCallback() to register/unregister the different possible callbacks identified by enum typedef HAL_DMA_CallbackIDTypeDef
    • Add new Error Codes: HAL_DMA_ERROR_NO_XFER and HAL_DMA_ERROR_NOT_SUPPORTED
  • HAL USART update
    • Add Transfer abort functions and callbacks
    • DMA Receive process; the code -has been updated to clear the USART OVR flag before enabling DMA receive request.

    • Update HAL_USART_IRQHandler() to add a check on interrupt source before managing the error 
  • - -HAL UART update -
    • Several update on HAL UART driver to implement the new UART state machine: 
      • Add new field in UART_HandleTypeDef structure: "rxState", UART state information related to Rx Operations
      • Rename "state" field in UART_HandleTypeDef structure by "gstate": UART state information related to global Handle management and Tx Operations
      • Update UART process to manage the new UART states.
      • Update __HAL_UART_RESET_HANDLE_STATE() macro -to handle the new UART state parameters (gState, rxState)
    • Add Transfer abort functions and callbacks
    • Update HAL_UART_IRQHandler() to add a check on interrupt source before managing the error 
    • DMA Receive process; the code -has been updated to clear the USART OVR flag before enabling DMA receive request.

- - - - -
  • - -HAL IRDA update -
    • Several update on HAL IRDA driver to implement the new UART state machine: 
      • Add new field in IRDA_HandleTypeDef structure: "rxState", IRDA state information related to Rx Operations
      • Rename "state" field in UART_HandleTypeDef structure by "gstate": IRDA state information related to global Handle management and Tx Operations
      • Update IRDA process to manage the new UART states.
      • Update __HAL_IRDA_RESET_HANDLE_STATE() macro -to handle the new IRDA state parameters (gState, rxState)
    • Removal of IRDA_TIMEOUT_VALUE define
    • Add Transfer abort functions and callbacks
    • Update HAL_IRDA_IRQHandler() to add a check on interrupt source before managing the error 
    • DMA Receive process; the code -has been updated to clear the USART OVR flag before enabling DMA receive request.

  • - -HAL SMARTCARD update -
    • Several update on HAL SMARTCARD driver to implement the new UART state machine: 
      • Add new field in SMARTCARD_HandleTypeDef structure: "rxState", SMARTCARDstate information related to Rx Operations
      • Rename "state" field in UART_HandleTypeDef structure by "gstate": SMARTCARDstate information related to global Handle management and Tx Operations
      • Update SMARTCARD process to manage the new UART states.
      • Update __HAL_SMARTCARD_RESET_HANDLE_STATE() macro -to handle the new SMARTCARD state parameters (gState, rxState)
    • Add Transfer abort functions and callbacks
    • Update HAL_SMARTCARD_IRQHandler() to add a check on interrupt source before managing the error 
    • DMA Receive process; the code -has been updated to clear the USART OVR flag before enabling DMA receive request.

  • HAL CAN update
    • Add - management of overrun error. 
    • Allow - possibility to receive messages from the 2 RX FIFOs in parallel via - interrupt.
    • Fix message - lost issue with specific sequence of transmit requests.
    • Handle - transmission failure with error callback, when NART is enabled.
    • Add __HAL_CAN_CANCEL_TRANSMIT() call to abort transmission when - timeout is reached
  • HAL TIM update
    • Add __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY() macro to disable Master output without check on TIM channel state. 
    • Update HAL_TIMEx_ConfigBreakDeadTime() to fix TIM BDTR register corruption.
    • Update Input Capture polarity by removing non-supported "TIM_INPUTCHANNELPOLARITY_BOTHEDGE" define.
    • Update HAL_TIM_ConfigOCrefClear() API by removing the usage of non-existant SMCR OCCS bit.
    • Add -"AutoReloadPreload" field to TIM_Base_InitTypeDef structure and -corresponding macros __HAL_TIM_ENABLE_OCxPRELOAD() and -__HAL_TIM_DISABLE_OCxPRELOAD() .
    • Update TIM_Base_SetConfig() API to set the auto-reload preload.
  • HAL I2C update
    • Update -HAL_I2C_Master_Transmit() and HAL_I2C_Slave_Transmit() to avoid sending -extra bytes at the end of the transmit processes
    • Update - HAL_I2C_Mem_Read() API to fix wrong check on misused parameter “Size”
    • Update - I2C_MasterReceive_RXNE() and I2C_MasterReceive_BTF() static APIs to - enhance Master sequential reception process.
  • HAL SPI update
    • Major Update to improve performance in - polling/interrupt mode to reach max frequency:
      • Polling mode :
        • Replace use of - SPI_WaitOnFlagUnitTimeout() funnction by "if" statement to - check on RXNE/TXE flage while transferring data.
        • Use API data pointer instead of SPI - handle data pointer.
      • Use a Goto implementation instead of - "if..else" statements
      • Interrupt mode
        • Minimize access on SPI registers.
        • Split the SPI modes into dedicated - static functions to minimize checking statements under - HAL_IRQHandler():
          • 1lines/2lines modes
          • 8 bit/ 16 bits data formats
          • CRC calculation enabled/disabled.
      • Remove waiting loop under ISR when - closing  the communication.
      • All modes:  
        • Adding switch USE_SPI_CRC to minimize - number of statements when CRC calculation is disabled.
        • Update Timeout management to check on - global process.
        • Update Error code management in all - processes.
    • Add note to the max frequencies reached in - all modes.
    • Add note about Master Receive mode - restrictions :
    • Master Receive mode restriction:
      -       (#) In Master unidirectional receive-only - mode (MSTR =1, BIDIMODE=0, RXONLY=0) or
      -           bidirectional - receive mode (MSTR=1, BIDIMODE=1, BIDIOE=0), to ensure that the SPI
      -           does not initiate - a new transfer the following procedure has to be respected:
      -           (##) - HAL_SPI_DeInit()
      -           (##) - HAL_SPI_Init()
    • Add transfer abort APIs and - associated callbacks in interrupt mode
      • HAL_SPI_Abort()
      • HAL_SPI_Abort_IT()
      • HAL_SPI_AbortCpltCallback()
  • - -HAL CEC update
    • Overall driver rework with break of compatibility with HAL V1.0.5
      • Remove the HAL CEC polling Process: HAL_CEC_Transmit() and HAL_CEC_Receive()
      • Remove the HAL CEC receive interrupt process (HAL_CEC_Receive_IT()) and manage the "Receive" mode enable within the Init phase
      • Rename HAL_CEC_GetReceivedFrameSize() function to HAL_CEC_GetLastReceivedFrameSize() function
      • Add new HAL APIs: HAL_CEC_SetDeviceAddress() and HAL_CEC_ChangeRxBuffer()
      • Remove the 'InitiatorAddress' -field from the CEC_InitTypeDef structure and manage -it as a parameter in the HAL_CEC_Transmit_IT() function
      • Add new parameter 'RxFrameSize' in HAL_CEC_RxCpltCallback() function
      • Move CEC Rx buffer pointer from CEC_HandleTypeDef structure to CEC_InitTypeDef structure
    • Update driver to implement the new CEC state machine:
      • Add new "rxState" field in CEC_HandleTypeDef structure to provide the CEC state information related to Rx Operations
      • Rename "state" field in CEC_HandleTypeDef structure to "gstate": CEC state information related to global Handle management and Tx Operations
      • Update CEC process to manage the new CEC states.
      • Update __HAL_CEC_RESET_HANDLE_STATE() macro to handle the new CEC state parameters (gState, rxState)
-
  • HAL I2S update
    • Update I2S Transmit/Receive polling process to manage Overrun and Underrun errors
    • HAL I2S driver ovall clean-up and optimization
    • HAL_I2S_Init() API updated to
      • Fix wrong I2S clock calculation when PCM mode is used.
      • Return state HAL_I2S_ERROR_PRESCALER when the I2S clock is wrongly configured
  • HAL NAND update
    • Modify NAND_AddressTypeDef, NAND_DeviceConfigTypeDef and NAND_HandleTypeDef structures fields
    • Add new HAL_NAND_ConfigDevice API
-
  • HAL USB PCD update
    • Flush all TX FIFOs on USB Reset
    • Remove Lock mechanism from HAL_PCD_EP_Transmit() and HAL_PCD_EP_Receive() API's
  • LL USB update
    • Enable DMA Burst mode for USB OTG HS
    • Fix SD card detection issue
  • LL SDMMC update
    • Add new SDMMC_CmdSDEraseStartAdd, SDMMC_CmdSDEraseEndAdd, SDMMC_CmdOpCondition and SDMMC_CmdSwitch functions

V1.0.5 / 06-December-2016

- - - - - - - - - - - - - - - - - - - - -

Main -Changes

-
  • General updates to fix mainly known I2C defects and enhancements implementation
  • The following changes done on the HAL drivers require an update on the application code based on HAL V1.0.4
    • HAL I2C driver:
      • Add  I2C  error management during DMA process. This requires the following updates on user application:
        • Configure and enable the I2C IRQ in HAL_I2C_MspInit() function
        • In stm32f1xx_it.c file, I2C _IRQHandler() function: add a call to HAL_I2C_IRQHandler() function
        • Add and customize the Error Callback API: HAL_I2C_ErrorCallback()
      • Update to avoid waiting on STOPF/BTF/AF flag under DMA ISR by using the I2C end of transfer interrupt in the DMA transfer process. This requires the following updates on user application:
        • Configure and enable the I2C IRQ in HAL_I2C_MspInit() function
        • In stm32f1xx_it.c file, I2C_IRQHandler() function: add a call to HAL_I2C_IRQHandler() function
      • I2C -transfer processes IT update: NACK during addressing phase is managed -through I2C Error interrupt instead of HAL state
  • HAL I2C update
    • Add support of I2C repeated start feature:
      • With the following new API's
        • HAL_I2C_Master_Sequential_Transmit_IT()
        • HAL_I2C_Master_Sequential_Receive_IT()
        • HAL_I2C_Master_Abort_IT()
        • HAL_I2C_Slave_Sequential_Transmit_IT()
        • HAL_I2C_Slave_Sequential_Receive_IT()
        • HAL_I2C_EnableListen_IT()
        • HAL_I2C_DisableListen_IT()
      • Add -new user callbacks:
        • HAL_I2C_ListenCpltCallback()
        • HAL_I2C_AddrCallback()
    • - -

      IRQ handler optimization: read -registers status only once

    • I2C addressing phase is updated to be managed using interrupt instead of polling
      • Add new static functions to manage I2C SB, ADDR and ADD10 flags
    • I2C IT transfer processes update: NACK during addressing phase is managed through I2C Error interrupt instead of HAL state
    • Update to generate STOP condition when a acknowledge failure error is detected 
    • Update I2C_WaitOnFlagUntilTimeout() to manage the NACK feature.
    • Update  I2C transmission process to support the case data size equal 0
    • Update Polling management:
      • The Timeout value must be estimated for the overall process duration: the Timeout measurement is cumulative
    • Add the management of Abort service: Abort DMA transfer through interrupt
      • In the case of Master Abort IT transfer usage:
        • Add new user HAL_I2C_AbortCpltCallback() to inform user of the end of abort process
        • A new abort state is defined in the HAL_I2C_StateTypeDef structure
    • Add -the management of I2C peripheral errors, ACK failure and STOP condition -detection during DMA process. This requires the following updates on -user application:
      • Configure and enable the I2C IRQ in HAL_I2C_MspInit() function
      • In stm32f1xx_it.c file, I2C_IRQHandler() function: add a call to HAL_I2C_IRQHandler() function
      • Add and customize the Error Callback API: HAL_I2C_ErrorCallback()
    • Update to avoid waiting on STOPF/BTF/AF flag under DMA ISR by using the I2C end of transfer interrupt in the DMA transfer process. This requires the following updates on user application:
      • Configure and enable the I2C IRQ in HAL_I2C_MspInit() function
      • In stm32f1xx_it.c file, I2C_IRQHandler() function: add a call to HAL_I2C_IRQHandler() function
    • Add a check if the I2C is already enabled at start of all I2C API's.
    • Update I2C API's (Polling, IT, DMA interfaces) to use hi2c->XferSize and hi2c->XferCount instead of size 
      parameter to help user to get information of counter in case of error

  • HAL DMA update
    • Add new API HAL_DMA_Abort_IT() to abort DMA transfer under interrupt context
      • The new registered Abort callback is called when DMA transfer abortion is completed
  • HAL ETH update
    • Remove ETH MAC debug register defines
  • HAL DAC update
    • Clean up: remove the following literals that aren't used 
      • DAC_WAVE_NOISE
      • DAC_WAVE_TRIANGLE

V1.0.4 / 29-April-2016

- - - - - - - - - - - - - - - - - - - - -

Main -Changes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  • General updates to fix known defects and enhancements implementation.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • HAL RCC
    • Add suffix U for defines equals to 0xFFFFFFFF (fix MISRA error 10.6)
    • Optimization of HAL_RCC_ClockConfig().
    • Replace aAPBAHBPrescTable by APBPrescTable and AHBPrescTable defined inside system_stm32f1xx.c.
    • When using HAL_RCC_OscConfig -to activate LSE, if LSE is already ON, it remains in its state ON. -Previously, it was turned OFF then ON in all cases.
    • The backup domain is no more reset when changing the RTC clock source from reset value.
    • Correct strange behavior in HAL_RCCEx_PeriphCLKConfig.
  • HAL UART
    • Correct the macro UART_BRR_SAMPLING16
  • HAL SMARTCARD
    • Correct the macro SMARTCARD_BRR
  • HAL IRDA
    • Correct the macro IRDA_BRR
    • EIE bit is no more activated in transmit (this bit only triggers errors in reception)
    • EIE bit is reset at the end of the reception.
  • HAL DMA
    • Add macro __HAL_DMA_GET_COUNTER to get the number of remaining data units in the current channel.
  • HAL FSMC
    • Adapt FSMC_NAND_Init behavior to the others STM32 series by reseting the bit FSMC_PCRx_PBKEN.

V1.0.3 / 11-January-2016

- - - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • Remove the #if defined(USE_HAL_LEGACY) condition to include Legacy/stm32_hal_legacy.h by default, in stm32f1xx_hal_def.h.

V1.0.2 / 18-December-2015

- - - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • General updates to fix known defects and enhancements implementation.
  • HAL generic
    • Insure that do {} while(0)  are used in in multi statement macros. (hal eth and pcd)
    • Manage simultaneous errors in IRQHandler. (hal uart, smartcard, usart and uart)
    • To -ensure the full compatibility of the GPIO interfaces across all the -STM32 families, the gpio speed definition have been renamed:
      • GPIO_SPEED_LOW to GPIO_SPEED_FREQ_LOW
      • GPIO_SPEED_MEDIUM to GPIO_SPEED_FREQ_MEDIUM
      • GPIO_SPEED_HIGH to GPIO_SPEED_FREQ_HIGH
      • aliases are created to keep backward compatibility
    • Reduce the default timeout value for the startup of the HSE form 5s to 100ms.
    • Update HAL weak empty callbacks to prevent unused argument compilation warnings with some compilers.
  • HAL ADC
    • Remove useless state HAL_ADC_STATE_REG_OVR and HAL_ADC_STATE_REG_EOSMP.
    • Add an error case if init is done with both continuous and discontinuous modes.
    • HAL_ADC_PollForEvent returns HAL_TIMEOUT if a timeout occurs instead of HAL_ERROR.
    • Trigger the assert_param of  the number of discontinuous conversion only if the discontinuous mode is enabled.
    • Enhance the check for ScanConvMode in HAL_ADC_Init.
  • HAL CAN
    • Clear the ERRI bit in HAL_CAN_IRQHandler.
  • HAL CORTEX
    • Remove the macro __HAL_CORTEX_SYSTICKCLK_CONFIG as duplicated by HAL_SYSTICK_CLKSourceConfig.
      • Create an alias to HAL_SYSTICK_CLKSourceConfig for backward compatibility.
  • HAL FLASH
    • The -parameter ReturnValue of HAL_FLASH_EndOfOperationCallback, in the case -of Pages Erase, now take the value of 0xFFFFFFFF if all the selected -pages have been erased.
    • Add a new interface HAL_FLASHEx_OBGetUserData to get the option byte user data.
  • HAL GPIO
    • Remove a useless assert_param on the pull mode in HAL_GPIO_Init.
  • HAL I2C
    • Correct issue at reception of 2 bytes using memory polling and IT interface.
    • Correct a wrong management of the AF flag.
  • HAL RCC
    • Reduce the timeout of HSI, LSI and PLL to be closer to HW specifications:
      • HSI_TIMEOUT_VALUE reduced from 100ms to 2ms
      • LSI_TIMEOUT_VALUE reduced from 100ms to 2ms
      • PLL_TIMEOUT_VALUE reduced from 100ms to 2ms
  • HAL SD
    • Correct wrong calculation of the capacity for High Capacity cards.
  • HAL SPI
    • Remove incorrect reset of DMA parameter in HAL_SPI_Receive_DMA and HAL_SPI_Transmit_DMA.
  • HAL TIM
    • Remove useless assert_param.
    • Rewrite the assert_param when setting clock source.
  • HAL UART
    • Manage the case of reception of a character while the driver is not expecting one. This was causing a crash of the driver.
  • LL USB
    • Remove the NoVbusSensing feature from driver. (feature not present on STM32F1xx)

V1.0.1 / 31-July-2015

- - - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • General updates to fix known defects and enhancements implementation.
  • HAL generic
    • stm32f1xx_hal_def.h
      • Update NULL definition to -fix C++ compilation issue.
  • HAL ADC
    • Optimization of macro __HAL_ADC_CLEAR_FLAG.
    • ADC poll for conversion now return error status in case of ADC-DMA mode.
    • ADC polling functions now return HAL_TIMEOUT (or HAL_ERROR in case of configuration error).
    • Removing field NbrOfConversionRank of ADC_HandleTypeDef. This field was useless on STM32F1xx.
    • Improving the ADC state machine.
  • HAL CAN
    • Field Data of CanRxMsgTypeDef and CanTxMsgTypeDef is changed from uint32_t to uint8_t.
  • HAL Cortex
    • Add MPU APIs in Cortex HAL driver.
  • HAL CRC
    • Correcting a wrong definition of __HAL_CRC_SET_IDR macro.
  • HAL DAC
    • HAL_IS_BIT_SET is nowused properly in HAL_DAC_Start.
    • Add 2 defines: DAC_WAVEGENERATION_NOISE and DAC_WAVEGENERATION_TRIANGLE.
    • HAL_DAC_Stop now disable DAC software conversion.
  • HAL DMA
    • Minor typographic updates.
  • HAL ETH
    • ETH_MAC_READCONTROLLER_FLUSHING: Removing a space in the middle of the name.
    • Removing some duplicated macros.
  • HAL FLASH
    • FLASH_OB_GetRDP -returns uint32_t instead of FlagStatus. (internal function). This -permit a more coherent use for HAL_FLASHEx_OBGetConfig -and HAL_FLASHEx_OBProgram.
    • Correct an issue making impossible to set Flash read protection level1 and  level2.
    • The activation of backup domain in RCC is systematic.
  • HAL I2C
    • Correct an issue depending of APB/I2C frequency which was preventing the STOP bit to be cleared.
      • The POS bit is now cleared at the beginning of each I2C API.
      • The POS bit is no more cleared near STOP generation.
  • HAL I2S
    • HAL_I2S_Transmit() API is updated to keep the check on busy flag only for the slave.
  • HAL NAND
    • Review __ARRAY_ADDRESS macro and adapt tests to detect bad blocks
  • HAL RCC
    • In HAL_RCCEx_PeriphCLKConfig, Reset backup domain only if RTC clock source has been changed.
    • Update of HAL_RCC_OscConfig functionto correctly check LSEState.
    • Rework __HAL_RCC_LSE_CONFIG macro to manage correctly LSE_Bypass.
    • New HAL RCC macro to configure the SYSCLK clock source: __HAL_RCC_SYSCLK_CONFIG(__RCC_SYSCLKSOURCE__).
    • Adding macro: __HAL_RCC_MCO_CONFIG.
    • For some RPN, the prediv source management in HAL_RCC_OscConfig function was not used.
  • HAL RTC
    • CMSIS mask definition used instead of hardcoded values.
  • HAL SMARTCARD
    • Improve documentation
  • HAL TIM
    • All STM32F101xx and STM32F102xx defines were missing in the file stm32f1xx_hal_tim_ex.h.
    • The assert on trigger polarity for TI1F_ED is removed.
  • HAL USB
    • Correct issue preventing USB Device double-buffering mode for IN endpoints to correctly behave.
    • Correct a bad configuration of Turnaround Time.
    • Correct USB_FlushTxFifo function which was leading to a GRSTCTL register corruption.
    • Replaced -the access to  USB_OTG_HCCHAR_CHDIS and USB_OTG_HCCHAR_CHENA -from a sequencial access to a simultaneous access.

V1.0.0 / 15-December-2014

Main -Changes

-
  • First Official release of STM32F1xx HAL -Drivers for all STM32F1 devices.
  • This -release is in line with STM32Cube -Firmware specification Rev1.0 document 

License

-
-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-
- -
-
-
-

For - complete documentation on STM32 - Microcontrollers visit www.st.com/STM32

-
-

-
- -
- -

 

- -
\ No newline at end of file diff --git a/workspace/TS100/HAL_Driver/STM32F100xE_User_Manual.chm b/workspace/TS100/HAL_Driver/STM32F100xE_User_Manual.chm deleted file mode 100644 index acb4bc98..00000000 Binary files a/workspace/TS100/HAL_Driver/STM32F100xE_User_Manual.chm and /dev/null differ diff --git a/workspace/TS100/HAL_Driver/STM32F103xB_User_Manual.chm b/workspace/TS100/HAL_Driver/STM32F103xB_User_Manual.chm deleted file mode 100644 index 37e65222..00000000 Binary files a/workspace/TS100/HAL_Driver/STM32F103xB_User_Manual.chm and /dev/null differ diff --git a/workspace/TS100/HAL_Driver/STM32F103xG_User_Manual.chm b/workspace/TS100/HAL_Driver/STM32F103xG_User_Manual.chm deleted file mode 100644 index 6b9bac8a..00000000 Binary files a/workspace/TS100/HAL_Driver/STM32F103xG_User_Manual.chm and /dev/null differ diff --git a/workspace/TS100/HAL_Driver/STM32F107xC_User_Manual.chm b/workspace/TS100/HAL_Driver/STM32F107xC_User_Manual.chm deleted file mode 100644 index 05562400..00000000 Binary files a/workspace/TS100/HAL_Driver/STM32F107xC_User_Manual.chm and /dev/null differ diff --git a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c b/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c deleted file mode 100644 index 7649cac2..00000000 --- a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c +++ /dev/null @@ -1,307 +0,0 @@ -/** - ****************************************************************************** - * @file stm32f1xx_hal_timebase_rtc_alarm_template.c - * @author MCD Application Team - * @version V1.1.1 - * @date 12-May-2017 - * @brief HAL time base based on the hardware RTC_ALARM. - * - * This file override the native HAL time base functions (defined as weak) - * to use the RTC ALARM for time base generation: - * + Intializes the RTC peripheral to increment the seconds registers each 1ms - * + The alarm is configured to assert an interrupt when the RTC reaches 1ms - * + HAL_IncTick is called at each Alarm event and the time is reset to 00:00:00 - * + HSE (default), LSE or LSI can be selected as RTC clock source - @verbatim - ============================================================================== - ##### How to use this driver ##### - ============================================================================== - [..] - This file must be copied to the application folder and modified as follows: - (#) Rename it to 'stm32f1xx_hal_timebase_rtc_alarm.c' - (#) Add this file and the RTC HAL drivers to your project and uncomment - HAL_RTC_MODULE_ENABLED define in stm32f1xx_hal_conf.h - - [..] - (@) HAL RTC alarm and HAL RTC wakeup drivers can’t be used with low power modes: - The wake up capability of the RTC may be intrusive in case of prior low power mode - configuration requiring different wake up sources. - Application/Example behavior is no more guaranteed - (@) The stm32f1xx_hal_timebase_tim use is recommended for the Applications/Examples - requiring low power modes - - @endverbatim - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f1xx_hal.h" -/** @addtogroup STM32F1xx_HAL_Driver - * @{ - */ - -/** @defgroup HAL_TimeBase_RTC_Alarm_Template HAL TimeBase RTC Alarm Template - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ - -/* Uncomment the line below to select the appropriate RTC Clock source for your application: - + RTC_CLOCK_SOURCE_HSE: can be selected for applications requiring timing precision. - + RTC_CLOCK_SOURCE_LSE: can be selected for applications with low constraint on timing - precision. - + RTC_CLOCK_SOURCE_LSI: can be selected for applications with low constraint on timing - precision. - */ -#define RTC_CLOCK_SOURCE_HSE -/* #define RTC_CLOCK_SOURCE_LSE */ -/* #define RTC_CLOCK_SOURCE_LSI */ - -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -RTC_HandleTypeDef hRTC_Handle; -/* Private function prototypes -----------------------------------------------*/ -void RTC_Alarm_IRQHandler(void); -/* Private functions ---------------------------------------------------------*/ - -/** - * @brief This function configures the RTC_ALARMA as a time base source. - * The time source is configured to have 1ms time base with a dedicated - * Tick interrupt priority. - * @note This function is called automatically at the beginning of program after - * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). - * @param TickPriority: Tick interrupt priority. - * @retval HAL status - */ -HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority) -{ - __IO uint32_t counter = 0U; - - RCC_OscInitTypeDef RCC_OscInitStruct; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; - -#ifdef RTC_CLOCK_SOURCE_LSE - /* Configue LSE as RTC clock soucre */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; - RCC_OscInitStruct.LSEState = RCC_LSE_ON; - PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; -#elif defined (RTC_CLOCK_SOURCE_LSI) - /* Configue LSI as RTC clock soucre */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; - RCC_OscInitStruct.LSIState = RCC_LSI_ON; - PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; -#elif defined (RTC_CLOCK_SOURCE_HSE) - /* Configue HSE as RTC clock soucre */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128; -#else -#error Please select the RTC Clock source -#endif /* RTC_CLOCK_SOURCE_LSE */ - - if(HAL_RCC_OscConfig(&RCC_OscInitStruct) == HAL_OK) - { - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; - if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) == HAL_OK) - { - /* Enable RTC Clock */ - __HAL_RCC_RTC_ENABLE(); - - hRTC_Handle.Instance = RTC; - /* Configure RTC time base to 10Khz */ - hRTC_Handle.Init.AsynchPrediv = (HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_RTC) / 10000) - 1; - hRTC_Handle.Init.OutPut = RTC_OUTPUTSOURCE_NONE; - HAL_RTC_Init(&hRTC_Handle); - - /* Disable the write protection for RTC registers */ - __HAL_RTC_WRITEPROTECTION_DISABLE(&hRTC_Handle); - - /* Clear flag alarm A */ - __HAL_RTC_ALARM_CLEAR_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF); - - counter = 0U; - /* Wait till RTC ALRAF flag is set and if Time out is reached exit */ - while(__HAL_RTC_ALARM_GET_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF) != RESET) - { - if(counter++ == SystemCoreClock /48U) /* Timeout = ~ 1s */ - { - return HAL_ERROR; - } - } - - /* Set RTC COUNTER MSB word */ - hRTC_Handle.Instance->ALRH = 0x00U; - /* Set RTC COUNTER LSB word */ - hRTC_Handle.Instance->ALRL = 0x09U; - - /* RTC Alarm Interrupt Configuration: EXTI configuration */ - __HAL_RTC_ALARM_EXTI_ENABLE_IT(); - __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); - - /* Clear Second and overflow flags */ - CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW)); - - /* Set RTC COUNTER MSB word */ - hRTC_Handle.Instance->CNTH = 0x00U; - /* Set RTC COUNTER LSB word */ - hRTC_Handle.Instance->CNTL = 0x00U; - - /* Configure the Alarm interrupt */ - __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA); - - /* Enable the write protection for RTC registers */ - __HAL_RTC_WRITEPROTECTION_ENABLE(&hRTC_Handle); - - /* Wait till RTC is in INIT state and if Time out is reached exit */ - counter = 0U; - while((hRTC_Handle.Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET) - { - if(counter++ == SystemCoreClock /48U) /* Timeout = ~ 1s */ - { - return HAL_ERROR; - } - } - - HAL_NVIC_SetPriority(RTC_Alarm_IRQn, TickPriority, 0U); - HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn); - return HAL_OK; - } - } - return HAL_ERROR; -} - -/** - * @brief Suspend Tick increment. - * @note Disable the tick increment by disabling RTC ALARM interrupt. - * @param None - * @retval None - */ -void HAL_SuspendTick(void) -{ - /* Disable RTC ALARM update Interrupt */ - __HAL_RTC_ALARM_DISABLE_IT(&hRTC_Handle, RTC_IT_ALRA); -} - -/** - * @brief Resume Tick increment. - * @note Enable the tick increment by Enabling RTC ALARM interrupt. - * @param None - * @retval None - */ -void HAL_ResumeTick(void) -{ - __IO uint32_t counter = 0U; - - /* Disable the write protection for RTC registers */ - __HAL_RTC_WRITEPROTECTION_DISABLE(&hRTC_Handle); - - /* Set RTC COUNTER MSB word */ - hRTC_Handle.Instance->CNTH = 0x00U; - /* Set RTC COUNTER LSB word */ - hRTC_Handle.Instance->CNTL = 0x00U; - - /* Clear Second and overflow flags */ - CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF)); - - /* Enable RTC ALARM Update interrupt */ - __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA); - - /* Enable the write protection for RTC registers */ - __HAL_RTC_WRITEPROTECTION_ENABLE(&hRTC_Handle); - - /* Wait till RTC is in INIT state and if Time out is reached exit */ - while((hRTC_Handle.Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET) - { - if(counter++ == SystemCoreClock /48U) /* Timeout = ~ 1s */ - { - break; - } - } -} - -/** - * @brief ALARM A Event Callback in non blocking mode - * @note This function is called when RTC_ALARM interrupt took place, inside - * RTC_ALARM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment - * a global variable "uwTick" used as application time base. - * @param hrtc : RTC handle - * @retval None - */ -void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) -{ - __IO uint32_t counter = 0U; - - HAL_IncTick(); - - __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); - - /* Set RTC COUNTER MSB word */ - WRITE_REG(hrtc->Instance->CNTH, 0x00U); - /* Set RTC COUNTER LSB word */ - WRITE_REG(hrtc->Instance->CNTL, 0x00U); - - /* Clear Second and overflow flags */ - CLEAR_BIT(hrtc->Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW)); - - /* Enable the write protection for RTC registers */ - __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); - - /* Wait till RTC is in INIT state and if Time out is reached exit */ - while((hrtc->Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET) - { - if(counter++ == SystemCoreClock /48U) /* Timeout = ~ 1s */ - { - break; - } - } -} - -/** - * @brief This function handles RTC ALARM interrupt request. - * @retval None - */ -void RTC_Alarm_IRQHandler(void) -{ - HAL_RTC_AlarmIRQHandler(&hRTC_Handle); -} - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_tim_template.c b/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_tim_template.c deleted file mode 100644 index 9bc6227e..00000000 --- a/workspace/TS100/HAL_Driver/Src/stm32f1xx_hal_timebase_tim_template.c +++ /dev/null @@ -1,184 +0,0 @@ -/** - ****************************************************************************** - * @file stm32f1xx_hal_timebase_tim_template.c - * @author MCD Application Team - * @version V1.1.1 - * @date 12-May-2017 - * @brief HAL time base based on the hardware TIM Template. - * - * This file overrides the native HAL time base functions (defined as weak) - * the TIM time base: - * + Intializes the TIM peripheral generate a Period elapsed Event each 1ms - * + HAL_IncTick is called inside HAL_TIM_PeriodElapsedCallback ie each 1ms - * - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2017 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f1xx_hal.h" - -/** @addtogroup STM32F1xx_HAL_Driver - * @{ - */ - -/** @addtogroup HAL_TimeBase_TIM - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -TIM_HandleTypeDef TimHandle; -/* Private function prototypes -----------------------------------------------*/ -void TIM2_IRQHandler(void); -/* Private functions ---------------------------------------------------------*/ - -/** - * @brief This function configures the TIM2 as a time base source. - * The time source is configured to have 1ms time base with a dedicated - * Tick interrupt priority. - * @note This function is called automatically at the beginning of program after - * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). - * @param TickPriority: Tick interrupt priority. - * @retval HAL status - */ -HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority) -{ - RCC_ClkInitTypeDef clkconfig; - uint32_t uwTimclock, uwAPB1Prescaler = 0U; - uint32_t uwPrescalerValue = 0U; - uint32_t pFLatency; - - /*Configure the TIM2 IRQ priority */ - HAL_NVIC_SetPriority(TIM2_IRQn, TickPriority ,0U); - - /* Enable the TIM2 global Interrupt */ - HAL_NVIC_EnableIRQ(TIM2_IRQn); - - /* Enable TIM2 clock */ - __HAL_RCC_TIM2_CLK_ENABLE(); - - /* Get clock configuration */ - HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); - - /* Get APB1 prescaler */ - uwAPB1Prescaler = clkconfig.APB1CLKDivider; - - /* Compute TIM2 clock */ - if (uwAPB1Prescaler == RCC_HCLK_DIV1) - { - uwTimclock = HAL_RCC_GetPCLK1Freq(); - } - else - { - uwTimclock = 2*HAL_RCC_GetPCLK1Freq(); - } - - /* Compute the prescaler value to have TIM2 counter clock equal to 1MHz */ - uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U); - - /* Initialize TIM2 */ - TimHandle.Instance = TIM2; - - /* Initialize TIMx peripheral as follow: - + Period = [(TIM2CLK/1000) - 1]. to have a (1/1000) s time base. - + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. - + ClockDivision = 0 - + Counter direction = Up - */ - TimHandle.Init.Period = (1000000U / 1000U) - 1U; - TimHandle.Init.Prescaler = uwPrescalerValue; - TimHandle.Init.ClockDivision = 0U; - TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; - TimHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; - if(HAL_TIM_Base_Init(&TimHandle) == HAL_OK) - { - /* Start the TIM time Base generation in interrupt mode */ - return HAL_TIM_Base_Start_IT(&TimHandle); - } - - /* Return function status */ - return HAL_ERROR; -} - -/** - * @brief Suspend Tick increment. - * @note Disable the tick increment by disabling TIM2 update interrupt. - * @retval None - */ -void HAL_SuspendTick(void) -{ - /* Disable TIM2 update Interrupt */ - __HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE); -} - -/** - * @brief Resume Tick increment. - * @note Enable the tick increment by Enabling TIM2 update interrupt. - * @retval None - */ -void HAL_ResumeTick(void) -{ - /* Enable TIM2 Update interrupt */ - __HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE); -} - -/** - * @brief Period elapsed callback in non blocking mode - * @note This function is called when TIM2 interrupt took place, inside - * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment - * a global variable "uwTick" used as application time base. - * @param htim : TIM handle - * @retval None - */ -void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) -{ - HAL_IncTick(); -} - -/** - * @brief This function handles TIM interrupt request. - * @retval None - */ -void TIM2_IRQHandler(void) -{ - HAL_TIM_IRQHandler(&TimHandle); -} - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/workspace/TS100/Makefile b/workspace/TS100/Makefile new file mode 100644 index 00000000..6c7a60c7 --- /dev/null +++ b/workspace/TS100/Makefile @@ -0,0 +1,219 @@ +# Discover the source files to build +SOURCE := $(shell find . -type f -name '*.c') +SOURCE_CPP := $(shell find . -type f -name '*.cpp') +S_SRCS := $(shell find . -type f -name '*.s') + +APP_INC_DIR = ./inc +CMSIS_DEVICE_INC_DIR = ./CMSIS/device +CMSIS_CORE_INC_DIR = ./CMSIS/core +HAL_INC_DIR = ./HAL_Driver/Inc +FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS +FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include +FRTOS_GCC_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 + +INCLUDES = -I$(APP_INC_DIR) \ + -I$(CMSIS_DEVICE_INC_DIR)\ + -I$(CMSIS_CORE_INC_DIR) \ + -I$(HAL_INC_DIR) \ + -I$(FRTOS_CMIS_INC_DIR) \ + -I$(FRTOS_INC_DIR) \ + -I$(FRTOS_GCC_INC_DIR) +# output folder +HEXFILE_DIR=Hexfile + +# temporary objects folder +OUTPUT_DIR=Objects + +# code optimisation ------------------------------------------------------------ +OPTIM=-O2 -finline-small-functions -findirect-inlining -fdiagnostics-color + + +# global defines --------------------------------------------------------------- +# Enable ROM library +#GLOBAL_DEFINES=-DTARGET_IS_BLIZZARD_RB1 -DUART_BUFFERED +# Without ROM library +#GLOBAL_DEFINES=-D DEPRECATED +#GLOBAL_DEFINES += -D SIMULATION_BOARD +GLOBAL_DEFINES += -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK + +# Enable debug code generation +DEBUG=-g +# Without debug code +#DEBUG= + + +# libs ------------------------------------------------------------------------- +LIBS= + +# linker script ---------------------------------------------------------------- +LDSCRIPT=LinkerScript.ld + +# ------------------------------------------------------------------------------ +COMPILER=gcc +# programs --------------------------------------------------------------------- +CC=arm-none-eabi-gcc +CPP=arm-none-eabi-g++ +AS=arm-none-eabi-as +GCOV=arm-none-eabi-gcov +OBJCOPY=arm-none-eabi-objcopy +OBJDUMP=arm-none-eabi-objdump +SIZE=arm-none-eabi-size +SREC=srec_cat +SREC_INFO=srec_info + + + + +# linker flags ----------------------------------------------------------------- +LINKER_FLAGS=-Wl,--gc-sections \ + -o$(OUT_HEXFILE).elf \ + -Wl,-Map=$(OUT_HEXFILE).map \ + -mcpu=cortex-m3 \ + -mthumb \ + -mfloat-abi=soft \ + -lm + +# compiler flags --------------------------------------------------------------- +CPUFLAGS=-D GCC_ARMCM3 \ + -D ARM_MATH_CM3 \ + -D STM32F10X_MD \ + -mthumb \ + -mcpu=cortex-m3 \ + -mfloat-abi=soft + + + +CHECKOPTIONS= -Wall \ + -Wextra \ + -Wunused \ + -Wcomment \ + -Wtrigraphs \ + -Wuninitialized \ + -Wmissing-braces \ + -Wfloat-equal \ + -Wunreachable-code \ + -Wswitch-default \ + -Wreturn-type \ + -Wundef \ + -Wparentheses \ + -Wnonnull \ + -Winit-self \ + -Wmissing-include-dirs \ + -Wsequence-point \ + -Wswitch \ + -Wformat \ + -Wsign-compare \ + -Waddress \ + -Waggregate-return \ + -Wmissing-field-initializers \ + -Winline \ + -Wshadow \ + -Wno-unused-parameter \ + -Wdouble-promotion + + +CHECKOPTIONS_C= -Wbad-function-cast + + +CXXFLAGS=$(CPUFLAGS) \ + $(DEBUG) \ + $(INCLUDES) \ + $(GLOBAL_DEFINES) \ + -D${COMPILER} \ + -MMD \ + $(CHECKOPTIONS) \ + -std=c++11 \ + $(OPTIM) \ + -fno-common \ + -ffreestanding \ + -fno-rtti \ + -fno-exceptions \ + -fno-non-call-exceptions \ + -fno-use-cxa-atexit \ + -T$(LDSCRIPT) + + +CFLAGS=$(CPUFLAGS) \ + $(DEBUG) \ + $(INCLUDES) \ + $(CHECKOPTIONS_C) \ + $(GLOBAL_DEFINES) \ + -D${COMPILER} \ + -MMD \ + -std=gnu99 \ + $(OPTIM) \ + -fno-common \ + -ffreestanding \ + -T$(LDSCRIPT) \ + -c + + +AFLAGS=$(CPUFLAGS) \ + $(DEBUG) \ + $(INCLUDES) + + +ifeq (${COMPILER}, gcc) +AFLAGS += -ffunction-sections -fdata-sections +CFLAGS += -ffunction-sections -fdata-sections +endif + + + +OBJS = $(SOURCE:.c=.o) +OBJS_CPP = $(SOURCE_CPP:.cpp=.o) +OBJS_S = $(S_SRCS:.s=.o) + + +OUTPUT_EXE=TS100 +OUT_OBJS=$(addprefix $(OUTPUT_DIR)/,$(OBJS)) +OUT_OBJS_CPP=$(addprefix $(OUTPUT_DIR)/,$(OBJS_CPP)) +OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S)) +OUT_HEXFILE=$(addprefix $(HEXFILE_DIR)/,$(OUTPUT_EXE)) + +all: $(OUT_HEXFILE).hex + +# +# The rule to create the target directory +# + +# Create hexfile +$(OUT_HEXFILE).hex : $(OUT_HEXFILE).elf + $(SIZE) -x $(OUT_HEXFILE).elf + $(OBJCOPY) $(OUT_HEXFILE).elf -O ihex $(OUT_HEXFILE).hex + +$(OUT_HEXFILE).elf : $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) Makefile $(LDSCRIPT) + @test -d $(@D) || mkdir -p $(@D) + @echo Linking $(OUTPUT_EXE).elf + @$(CPP) $(CXXFLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS) $(LINKER_FLAGS) + +$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile + @test -d $(@D) || mkdir -p $(@D) + @echo Compiling ${<} +# @echo $(CFLAGS) + @$(CC) -c $(CFLAGS) $< -o $@ + @$(OBJDUMP) -d -S $@ > $@.lst + +$(OUT_OBJS_CPP): $(OUTPUT_DIR)/%.o : %.cpp Makefile + @test -d $(@D) || mkdir -p $(@D) + @echo Compiling ${<} + @$(CPP) -c $(CXXFLAGS) $< -o $@ + @$(OBJDUMP) -d -S $@ > $@.lst + +$(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.s Makefile + @test -d $(@D) || mkdir -p $(@D) + @echo 'Building file: $<' + @echo 'Invoking: MCU GCC Assembler' + @$(AS) -mcpu=cortex-m3 -mthumb -mfloat-abi=soft $(INCLUDES) -g $< -o $@ + @echo 'Finished building: $<' + @echo ' ' + + +clean : + rm -Rf $(OUTPUT_DIR) + rm -Rf $(HEXFILE_DIR) + +# pull in dependency info for *existing* .o files +-include $(OUT_OBJS:.o=.d) +-include $(OUT_OBJS_CPP:.o=.d) + diff --git a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_1.c b/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_1.c deleted file mode 100644 index 6dfb3cbc..00000000 --- a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. - - *************************************************************************** - >>! NOTE: The modification to the GPL is included to allow you to !<< - >>! distribute a combined work that includes FreeRTOS without being !<< - >>! obliged to provide the source code for proprietary components !<< - >>! outside of the FreeRTOS kernel. !<< - *************************************************************************** - - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available on the following - link: http://www.freertos.org/a00114.html - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that is more than just the market leader, it * - * is the industry's de facto standard. * - * * - * Help yourself get started quickly while simultaneously helping * - * to support the FreeRTOS project by purchasing a FreeRTOS * - * tutorial book, reference manual, or both: * - * http://www.FreeRTOS.org/Documentation * - * * - *************************************************************************** - - http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading - the FAQ page "My application does not run, what could be wrong?". Have you - defined configASSERT()? - - http://www.FreeRTOS.org/support - In return for receiving this top quality - embedded software for free we request you assist our global community by - participating in the support forum. - - http://www.FreeRTOS.org/training - Investing in training allows your team to - be as productive as possible as early as possible. Now you can receive - FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers - Ltd, and the world's leading authority on the world's leading RTOS. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, a DOS - compatible FAT file system, and our tiny thread aware UDP/IP stack. - - http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. - Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. - - http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High - Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and commercial middleware. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ - - -/* - * The simplest possible implementation of pvPortMalloc(). Note that this - * implementation does NOT allow allocated memory to be freed again. - * - * See heap_2.c, heap_3.c and heap_4.c for alternative implementations, and the - * memory management pages of http://www.FreeRTOS.org for more information. - */ -#include - -/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining -all the API functions to use the MPU wrappers. That should only be done when -task.h is included from an application file. */ -#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#include "FreeRTOS.h" -#include "task.h" - -#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#if( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) - #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 -#endif - -/* A few bytes might be lost to byte aligning the heap start address. */ -#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) - -/* Allocate the memory for the heap. */ -/* Allocate the memory for the heap. */ -#if( configAPPLICATION_ALLOCATED_HEAP == 1 ) - /* The application writer has already defined the array used for the RTOS - heap - probably so it can be placed in a special segment or address. */ - extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; -#else - static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; -#endif /* configAPPLICATION_ALLOCATED_HEAP */ - -static size_t xNextFreeByte = ( size_t ) 0; - -/*-----------------------------------------------------------*/ - -void *pvPortMalloc( size_t xWantedSize ) -{ -void *pvReturn = NULL; -static uint8_t *pucAlignedHeap = NULL; - - /* Ensure that blocks are always aligned to the required number of bytes. */ - #if( portBYTE_ALIGNMENT != 1 ) - { - if( xWantedSize & portBYTE_ALIGNMENT_MASK ) - { - /* Byte alignment required. */ - xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); - } - } - #endif - - vTaskSuspendAll(); - { - if( pucAlignedHeap == NULL ) - { - /* Ensure the heap starts on a correctly aligned boundary. */ - pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); - } - - /* Check there is enough room left for the allocation. */ - if( ( ( xNextFreeByte + xWantedSize ) < configADJUSTED_HEAP_SIZE ) && - ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) )/* Check for overflow. */ - { - /* Return the next free byte then increment the index past this - block. */ - pvReturn = pucAlignedHeap + xNextFreeByte; - xNextFreeByte += xWantedSize; - } - - traceMALLOC( pvReturn, xWantedSize ); - } - ( void ) xTaskResumeAll(); - - #if( configUSE_MALLOC_FAILED_HOOK == 1 ) - { - if( pvReturn == NULL ) - { - extern void vApplicationMallocFailedHook( void ); - vApplicationMallocFailedHook(); - } - } - #endif - - return pvReturn; -} -/*-----------------------------------------------------------*/ - -void vPortFree( void *pv ) -{ - /* Memory cannot be freed using this scheme. See heap_2.c, heap_3.c and - heap_4.c for alternative implementations, and the memory management pages of - http://www.FreeRTOS.org for more information. */ - ( void ) pv; - - /* Force an assert as it is invalid to call this function. */ - configASSERT( pv == NULL ); -} -/*-----------------------------------------------------------*/ - -void vPortInitialiseBlocks( void ) -{ - /* Only required when static memory is not cleared. */ - xNextFreeByte = ( size_t ) 0; -} -/*-----------------------------------------------------------*/ - -size_t xPortGetFreeHeapSize( void ) -{ - return ( configADJUSTED_HEAP_SIZE - xNextFreeByte ); -} - - - diff --git a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_2.c b/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_2.c deleted file mode 100644 index bba85540..00000000 --- a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_2.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. - - *************************************************************************** - >>! NOTE: The modification to the GPL is included to allow you to !<< - >>! distribute a combined work that includes FreeRTOS without being !<< - >>! obliged to provide the source code for proprietary components !<< - >>! outside of the FreeRTOS kernel. !<< - *************************************************************************** - - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available on the following - link: http://www.freertos.org/a00114.html - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that is more than just the market leader, it * - * is the industry's de facto standard. * - * * - * Help yourself get started quickly while simultaneously helping * - * to support the FreeRTOS project by purchasing a FreeRTOS * - * tutorial book, reference manual, or both: * - * http://www.FreeRTOS.org/Documentation * - * * - *************************************************************************** - - http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading - the FAQ page "My application does not run, what could be wrong?". Have you - defined configASSERT()? - - http://www.FreeRTOS.org/support - In return for receiving this top quality - embedded software for free we request you assist our global community by - participating in the support forum. - - http://www.FreeRTOS.org/training - Investing in training allows your team to - be as productive as possible as early as possible. Now you can receive - FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers - Ltd, and the world's leading authority on the world's leading RTOS. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, a DOS - compatible FAT file system, and our tiny thread aware UDP/IP stack. - - http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. - Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. - - http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High - Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and commercial middleware. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ - -/* - * A sample implementation of pvPortMalloc() and vPortFree() that permits - * allocated blocks to be freed, but does not combine adjacent free blocks - * into a single larger block (and so will fragment memory). See heap_4.c for - * an equivalent that does combine adjacent blocks into single larger blocks. - * - * See heap_1.c, heap_3.c and heap_4.c for alternative implementations, and the - * memory management pages of http://www.FreeRTOS.org for more information. - */ -#include - -/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining -all the API functions to use the MPU wrappers. That should only be done when -task.h is included from an application file. */ -#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#include "FreeRTOS.h" -#include "task.h" - -#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#if( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) - #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 -#endif - -/* A few bytes might be lost to byte aligning the heap start address. */ -#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) - -/* - * Initialises the heap structures before their first use. - */ -static void prvHeapInit( void ); - -/* Allocate the memory for the heap. */ -#if( configAPPLICATION_ALLOCATED_HEAP == 1 ) - /* The application writer has already defined the array used for the RTOS - heap - probably so it can be placed in a special segment or address. */ - extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; -#else - static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; -#endif /* configAPPLICATION_ALLOCATED_HEAP */ - - -/* Define the linked list structure. This is used to link free blocks in order -of their size. */ -typedef struct A_BLOCK_LINK -{ - struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */ - size_t xBlockSize; /*<< The size of the free block. */ -} BlockLink_t; - - -static const uint16_t heapSTRUCT_SIZE = ( ( sizeof ( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK ); -#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) ) - -/* Create a couple of list links to mark the start and end of the list. */ -static BlockLink_t xStart, xEnd; - -/* Keeps track of the number of free bytes remaining, but says nothing about -fragmentation. */ -static size_t xFreeBytesRemaining = configADJUSTED_HEAP_SIZE; - -/* STATIC FUNCTIONS ARE DEFINED AS MACROS TO MINIMIZE THE FUNCTION CALL DEPTH. */ - -/* - * Insert a block into the list of free blocks - which is ordered by size of - * the block. Small blocks at the start of the list and large blocks at the end - * of the list. - */ -#define prvInsertBlockIntoFreeList( pxBlockToInsert ) \ -{ \ -BlockLink_t *pxIterator; \ -size_t xBlockSize; \ - \ - xBlockSize = pxBlockToInsert->xBlockSize; \ - \ - /* Iterate through the list until a block is found that has a larger size */ \ - /* than the block we are inserting. */ \ - for( pxIterator = &xStart; pxIterator->pxNextFreeBlock->xBlockSize < xBlockSize; pxIterator = pxIterator->pxNextFreeBlock ) \ - { \ - /* There is nothing to do here - just iterate to the correct position. */ \ - } \ - \ - /* Update the list to include the block being inserted in the correct */ \ - /* position. */ \ - pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock; \ - pxIterator->pxNextFreeBlock = pxBlockToInsert; \ -} -/*-----------------------------------------------------------*/ - -void *pvPortMalloc( size_t xWantedSize ) -{ -BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink; -static BaseType_t xHeapHasBeenInitialised = pdFALSE; -void *pvReturn = NULL; - - vTaskSuspendAll(); - { - /* If this is the first call to malloc then the heap will require - initialisation to setup the list of free blocks. */ - if( xHeapHasBeenInitialised == pdFALSE ) - { - prvHeapInit(); - xHeapHasBeenInitialised = pdTRUE; - } - - /* The wanted size is increased so it can contain a BlockLink_t - structure in addition to the requested amount of bytes. */ - if( xWantedSize > 0 ) - { - xWantedSize += heapSTRUCT_SIZE; - - /* Ensure that blocks are always aligned to the required number of bytes. */ - if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0 ) - { - /* Byte alignment required. */ - xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); - } - } - - if( ( xWantedSize > 0 ) && ( xWantedSize < configADJUSTED_HEAP_SIZE ) ) - { - /* Blocks are stored in byte order - traverse the list from the start - (smallest) block until one of adequate size is found. */ - pxPreviousBlock = &xStart; - pxBlock = xStart.pxNextFreeBlock; - while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) - { - pxPreviousBlock = pxBlock; - pxBlock = pxBlock->pxNextFreeBlock; - } - - /* If we found the end marker then a block of adequate size was not found. */ - if( pxBlock != &xEnd ) - { - /* Return the memory space - jumping over the BlockLink_t structure - at its start. */ - pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE ); - - /* This block is being returned for use so must be taken out of the - list of free blocks. */ - pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock; - - /* If the block is larger than required it can be split into two. */ - if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) - { - /* This block is to be split into two. Create a new block - following the number of bytes requested. The void cast is - used to prevent byte alignment warnings from the compiler. */ - pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize ); - - /* Calculate the sizes of two blocks split from the single - block. */ - pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize; - pxBlock->xBlockSize = xWantedSize; - - /* Insert the new block into the list of free blocks. */ - prvInsertBlockIntoFreeList( ( pxNewBlockLink ) ); - } - - xFreeBytesRemaining -= pxBlock->xBlockSize; - } - } - - traceMALLOC( pvReturn, xWantedSize ); - } - ( void ) xTaskResumeAll(); - - #if( configUSE_MALLOC_FAILED_HOOK == 1 ) - { - if( pvReturn == NULL ) - { - extern void vApplicationMallocFailedHook( void ); - vApplicationMallocFailedHook(); - } - } - #endif - - return pvReturn; -} -/*-----------------------------------------------------------*/ - -void vPortFree( void *pv ) -{ -uint8_t *puc = ( uint8_t * ) pv; -BlockLink_t *pxLink; - - if( pv != NULL ) - { - /* The memory being freed will have an BlockLink_t structure immediately - before it. */ - puc -= heapSTRUCT_SIZE; - - /* This unexpected casting is to keep some compilers from issuing - byte alignment warnings. */ - pxLink = ( void * ) puc; - - vTaskSuspendAll(); - { - /* Add this block to the list of free blocks. */ - prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) ); - xFreeBytesRemaining += pxLink->xBlockSize; - traceFREE( pv, pxLink->xBlockSize ); - } - ( void ) xTaskResumeAll(); - } -} -/*-----------------------------------------------------------*/ - -size_t xPortGetFreeHeapSize( void ) -{ - return xFreeBytesRemaining; -} -/*-----------------------------------------------------------*/ - -void vPortInitialiseBlocks( void ) -{ - /* This just exists to keep the linker quiet. */ -} -/*-----------------------------------------------------------*/ - -static void prvHeapInit( void ) -{ -BlockLink_t *pxFirstFreeBlock; -uint8_t *pucAlignedHeap; - - /* Ensure the heap starts on a correctly aligned boundary. */ - pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); - - /* xStart is used to hold a pointer to the first item in the list of free - blocks. The void cast is used to prevent compiler warnings. */ - xStart.pxNextFreeBlock = ( void * ) pucAlignedHeap; - xStart.xBlockSize = ( size_t ) 0; - - /* xEnd is used to mark the end of the list of free blocks. */ - xEnd.xBlockSize = configADJUSTED_HEAP_SIZE; - xEnd.pxNextFreeBlock = NULL; - - /* To start with there is a single free block that is sized to take up the - entire heap space. */ - pxFirstFreeBlock = ( void * ) pucAlignedHeap; - pxFirstFreeBlock->xBlockSize = configADJUSTED_HEAP_SIZE; - pxFirstFreeBlock->pxNextFreeBlock = &xEnd; -} -/*-----------------------------------------------------------*/ diff --git a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_3.c b/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_3.c deleted file mode 100644 index f9220018..00000000 --- a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_3.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. - - *************************************************************************** - >>! NOTE: The modification to the GPL is included to allow you to !<< - >>! distribute a combined work that includes FreeRTOS without being !<< - >>! obliged to provide the source code for proprietary components !<< - >>! outside of the FreeRTOS kernel. !<< - *************************************************************************** - - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available on the following - link: http://www.freertos.org/a00114.html - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that is more than just the market leader, it * - * is the industry's de facto standard. * - * * - * Help yourself get started quickly while simultaneously helping * - * to support the FreeRTOS project by purchasing a FreeRTOS * - * tutorial book, reference manual, or both: * - * http://www.FreeRTOS.org/Documentation * - * * - *************************************************************************** - - http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading - the FAQ page "My application does not run, what could be wrong?". Have you - defined configASSERT()? - - http://www.FreeRTOS.org/support - In return for receiving this top quality - embedded software for free we request you assist our global community by - participating in the support forum. - - http://www.FreeRTOS.org/training - Investing in training allows your team to - be as productive as possible as early as possible. Now you can receive - FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers - Ltd, and the world's leading authority on the world's leading RTOS. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, a DOS - compatible FAT file system, and our tiny thread aware UDP/IP stack. - - http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. - Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. - - http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High - Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and commercial middleware. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ - - -/* - * Implementation of pvPortMalloc() and vPortFree() that relies on the - * compilers own malloc() and free() implementations. - * - * This file can only be used if the linker is configured to to generate - * a heap memory area. - * - * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the - * memory management pages of http://www.FreeRTOS.org for more information. - */ - -#include - -/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining -all the API functions to use the MPU wrappers. That should only be done when -task.h is included from an application file. */ -#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#include "FreeRTOS.h" -#include "task.h" - -#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#if( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) - #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 -#endif - -/*-----------------------------------------------------------*/ - -void *pvPortMalloc( size_t xWantedSize ) -{ -void *pvReturn; - - vTaskSuspendAll(); - { - pvReturn = malloc( xWantedSize ); - traceMALLOC( pvReturn, xWantedSize ); - } - ( void ) xTaskResumeAll(); - - #if( configUSE_MALLOC_FAILED_HOOK == 1 ) - { - if( pvReturn == NULL ) - { - extern void vApplicationMallocFailedHook( void ); - vApplicationMallocFailedHook(); - } - } - #endif - - return pvReturn; -} -/*-----------------------------------------------------------*/ - -void vPortFree( void *pv ) -{ - if( pv ) - { - vTaskSuspendAll(); - { - free( pv ); - traceFREE( pv, 0 ); - } - ( void ) xTaskResumeAll(); - } -} - - - diff --git a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_5.c b/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_5.c deleted file mode 100644 index d53e41e8..00000000 --- a/workspace/TS100/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_5.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - This file is part of the FreeRTOS distribution. - - FreeRTOS is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License (version 2) as published by the - Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. - - *************************************************************************** - >>! NOTE: The modification to the GPL is included to allow you to !<< - >>! distribute a combined work that includes FreeRTOS without being !<< - >>! obliged to provide the source code for proprietary components !<< - >>! outside of the FreeRTOS kernel. !<< - *************************************************************************** - - FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available on the following - link: http://www.freertos.org/a00114.html - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that is more than just the market leader, it * - * is the industry's de facto standard. * - * * - * Help yourself get started quickly while simultaneously helping * - * to support the FreeRTOS project by purchasing a FreeRTOS * - * tutorial book, reference manual, or both: * - * http://www.FreeRTOS.org/Documentation * - * * - *************************************************************************** - - http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading - the FAQ page "My application does not run, what could be wrong?". Have you - defined configASSERT()? - - http://www.FreeRTOS.org/support - In return for receiving this top quality - embedded software for free we request you assist our global community by - participating in the support forum. - - http://www.FreeRTOS.org/training - Investing in training allows your team to - be as productive as possible as early as possible. Now you can receive - FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers - Ltd, and the world's leading authority on the world's leading RTOS. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, a DOS - compatible FAT file system, and our tiny thread aware UDP/IP stack. - - http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. - Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. - - http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High - Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and commercial middleware. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ - -/* - * A sample implementation of pvPortMalloc() that allows the heap to be defined - * across multiple non-contigous blocks and combines (coalescences) adjacent - * memory blocks as they are freed. - * - * See heap_1.c, heap_2.c, heap_3.c and heap_4.c for alternative - * implementations, and the memory management pages of http://www.FreeRTOS.org - * for more information. - * - * Usage notes: - * - * vPortDefineHeapRegions() ***must*** be called before pvPortMalloc(). - * pvPortMalloc() will be called if any task objects (tasks, queues, event - * groups, etc.) are created, therefore vPortDefineHeapRegions() ***must*** be - * called before any other objects are defined. - * - * vPortDefineHeapRegions() takes a single parameter. The parameter is an array - * of HeapRegion_t structures. HeapRegion_t is defined in portable.h as - * - * typedef struct HeapRegion - * { - * uint8_t *pucStartAddress; << Start address of a block of memory that will be part of the heap. - * size_t xSizeInBytes; << Size of the block of memory. - * } HeapRegion_t; - * - * The array is terminated using a NULL zero sized region definition, and the - * memory regions defined in the array ***must*** appear in address order from - * low address to high address. So the following is a valid example of how - * to use the function. - * - * HeapRegion_t xHeapRegions[] = - * { - * { ( uint8_t * ) 0x80000000UL, 0x10000 }, << Defines a block of 0x10000 bytes starting at address 0x80000000 - * { ( uint8_t * ) 0x90000000UL, 0xa0000 }, << Defines a block of 0xa0000 bytes starting at address of 0x90000000 - * { NULL, 0 } << Terminates the array. - * }; - * - * vPortDefineHeapRegions( xHeapRegions ); << Pass the array into vPortDefineHeapRegions(). - * - * Note 0x80000000 is the lower address so appears in the array first. - * - */ -#include - -/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining -all the API functions to use the MPU wrappers. That should only be done when -task.h is included from an application file. */ -#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#include "FreeRTOS.h" -#include "task.h" - -#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#if( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) - #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 -#endif - -/* Block sizes must not get too small. */ -#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize << 1 ) ) - -/* Assumes 8bit bytes! */ -#define heapBITS_PER_BYTE ( ( size_t ) 8 ) - -/* Define the linked list structure. This is used to link free blocks in order -of their memory address. */ -typedef struct A_BLOCK_LINK -{ - struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */ - size_t xBlockSize; /*<< The size of the free block. */ -} BlockLink_t; - -/*-----------------------------------------------------------*/ - -/* - * Inserts a block of memory that is being freed into the correct position in - * the list of free memory blocks. The block being freed will be merged with - * the block in front it and/or the block behind it if the memory blocks are - * adjacent to each other. - */ -static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ); - -/*-----------------------------------------------------------*/ - -/* The size of the structure placed at the beginning of each allocated memory -block must by correctly byte aligned. */ -static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK ); - -/* Create a couple of list links to mark the start and end of the list. */ -static BlockLink_t xStart, *pxEnd = NULL; - -/* Keeps track of the number of free bytes remaining, but says nothing about -fragmentation. */ -static size_t xFreeBytesRemaining = 0U; -static size_t xMinimumEverFreeBytesRemaining = 0U; - -/* Gets set to the top bit of an size_t type. When this bit in the xBlockSize -member of an BlockLink_t structure is set then the block belongs to the -application. When the bit is free the block is still part of the free heap -space. */ -static size_t xBlockAllocatedBit = 0; - -/*-----------------------------------------------------------*/ - -void *pvPortMalloc( size_t xWantedSize ) -{ -BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink; -void *pvReturn = NULL; - - /* The heap must be initialised before the first call to - prvPortMalloc(). */ - configASSERT( pxEnd ); - - vTaskSuspendAll(); - { - /* Check the requested block size is not so large that the top bit is - set. The top bit of the block size member of the BlockLink_t structure - is used to determine who owns the block - the application or the - kernel, so it must be free. */ - if( ( xWantedSize & xBlockAllocatedBit ) == 0 ) - { - /* The wanted size is increased so it can contain a BlockLink_t - structure in addition to the requested amount of bytes. */ - if( xWantedSize > 0 ) - { - xWantedSize += xHeapStructSize; - - /* Ensure that blocks are always aligned to the required number - of bytes. */ - if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 ) - { - /* Byte alignment required. */ - xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) ) - { - /* Traverse the list from the start (lowest address) block until - one of adequate size is found. */ - pxPreviousBlock = &xStart; - pxBlock = xStart.pxNextFreeBlock; - while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) - { - pxPreviousBlock = pxBlock; - pxBlock = pxBlock->pxNextFreeBlock; - } - - /* If the end marker was reached then a block of adequate size - was not found. */ - if( pxBlock != pxEnd ) - { - /* Return the memory space pointed to - jumping over the - BlockLink_t structure at its start. */ - pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + xHeapStructSize ); - - /* This block is being returned for use so must be taken out - of the list of free blocks. */ - pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock; - - /* If the block is larger than required it can be split into - two. */ - if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) - { - /* This block is to be split into two. Create a new - block following the number of bytes requested. The void - cast is used to prevent byte alignment warnings from the - compiler. */ - pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize ); - - /* Calculate the sizes of two blocks split from the - single block. */ - pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize; - pxBlock->xBlockSize = xWantedSize; - - /* Insert the new block into the list of free blocks. */ - prvInsertBlockIntoFreeList( ( pxNewBlockLink ) ); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - xFreeBytesRemaining -= pxBlock->xBlockSize; - - if( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining ) - { - xMinimumEverFreeBytesRemaining = xFreeBytesRemaining; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - /* The block is being returned - it is allocated and owned - by the application and has no "next" block. */ - pxBlock->xBlockSize |= xBlockAllocatedBit; - pxBlock->pxNextFreeBlock = NULL; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - traceMALLOC( pvReturn, xWantedSize ); - } - ( void ) xTaskResumeAll(); - - #if( configUSE_MALLOC_FAILED_HOOK == 1 ) - { - if( pvReturn == NULL ) - { - extern void vApplicationMallocFailedHook( void ); - vApplicationMallocFailedHook(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #endif - - return pvReturn; -} -/*-----------------------------------------------------------*/ - -void vPortFree( void *pv ) -{ -uint8_t *puc = ( uint8_t * ) pv; -BlockLink_t *pxLink; - - if( pv != NULL ) - { - /* The memory being freed will have an BlockLink_t structure immediately - before it. */ - puc -= xHeapStructSize; - - /* This casting is to keep the compiler from issuing warnings. */ - pxLink = ( void * ) puc; - - /* Check the block is actually allocated. */ - configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ); - configASSERT( pxLink->pxNextFreeBlock == NULL ); - - if( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ) - { - if( pxLink->pxNextFreeBlock == NULL ) - { - /* The block is being returned to the heap - it is no longer - allocated. */ - pxLink->xBlockSize &= ~xBlockAllocatedBit; - - vTaskSuspendAll(); - { - /* Add this block to the list of free blocks. */ - xFreeBytesRemaining += pxLink->xBlockSize; - traceFREE( pv, pxLink->xBlockSize ); - prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) ); - } - ( void ) xTaskResumeAll(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } -} -/*-----------------------------------------------------------*/ - -size_t xPortGetFreeHeapSize( void ) -{ - return xFreeBytesRemaining; -} -/*-----------------------------------------------------------*/ - -size_t xPortGetMinimumEverFreeHeapSize( void ) -{ - return xMinimumEverFreeBytesRemaining; -} -/*-----------------------------------------------------------*/ - -static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ) -{ -BlockLink_t *pxIterator; -uint8_t *puc; - - /* Iterate through the list until a block is found that has a higher address - than the block being inserted. */ - for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock ) - { - /* Nothing to do here, just iterate to the right position. */ - } - - /* Do the block being inserted, and the block it is being inserted after - make a contiguous block of memory? */ - puc = ( uint8_t * ) pxIterator; - if( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert ) - { - pxIterator->xBlockSize += pxBlockToInsert->xBlockSize; - pxBlockToInsert = pxIterator; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - /* Do the block being inserted, and the block it is being inserted before - make a contiguous block of memory? */ - puc = ( uint8_t * ) pxBlockToInsert; - if( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock ) - { - if( pxIterator->pxNextFreeBlock != pxEnd ) - { - /* Form one big block from the two blocks. */ - pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize; - pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock; - } - else - { - pxBlockToInsert->pxNextFreeBlock = pxEnd; - } - } - else - { - pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock; - } - - /* If the block being inserted plugged a gab, so was merged with the block - before and the block after, then it's pxNextFreeBlock pointer will have - already been set, and should not be set here as that would make it point - to itself. */ - if( pxIterator != pxBlockToInsert ) - { - pxIterator->pxNextFreeBlock = pxBlockToInsert; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } -} -/*-----------------------------------------------------------*/ - -void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) -{ -BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock; -size_t xAlignedHeap; -size_t xTotalRegionSize, xTotalHeapSize = 0; -BaseType_t xDefinedRegions = 0; -size_t xAddress; -const HeapRegion_t *pxHeapRegion; - - /* Can only call once! */ - configASSERT( pxEnd == NULL ); - - pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] ); - - while( pxHeapRegion->xSizeInBytes > 0 ) - { - xTotalRegionSize = pxHeapRegion->xSizeInBytes; - - /* Ensure the heap region starts on a correctly aligned boundary. */ - xAddress = ( size_t ) pxHeapRegion->pucStartAddress; - if( ( xAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) - { - xAddress += ( portBYTE_ALIGNMENT - 1 ); - xAddress &= ~portBYTE_ALIGNMENT_MASK; - - /* Adjust the size for the bytes lost to alignment. */ - xTotalRegionSize -= xAddress - ( size_t ) pxHeapRegion->pucStartAddress; - } - - xAlignedHeap = xAddress; - - /* Set xStart if it has not already been set. */ - if( xDefinedRegions == 0 ) - { - /* xStart is used to hold a pointer to the first item in the list of - free blocks. The void cast is used to prevent compiler warnings. */ - xStart.pxNextFreeBlock = ( BlockLink_t * ) xAlignedHeap; - xStart.xBlockSize = ( size_t ) 0; - } - else - { - /* Should only get here if one region has already been added to the - heap. */ - configASSERT( pxEnd != NULL ); - - /* Check blocks are passed in with increasing start addresses. */ - configASSERT( xAddress > ( size_t ) pxEnd ); - } - - /* Remember the location of the end marker in the previous region, if - any. */ - pxPreviousFreeBlock = pxEnd; - - /* pxEnd is used to mark the end of the list of free blocks and is - inserted at the end of the region space. */ - xAddress = xAlignedHeap + xTotalRegionSize; - xAddress -= xHeapStructSize; - xAddress &= ~portBYTE_ALIGNMENT_MASK; - pxEnd = ( BlockLink_t * ) xAddress; - pxEnd->xBlockSize = 0; - pxEnd->pxNextFreeBlock = NULL; - - /* To start with there is a single free block in this region that is - sized to take up the entire heap region minus the space taken by the - free block structure. */ - pxFirstFreeBlockInRegion = ( BlockLink_t * ) xAlignedHeap; - pxFirstFreeBlockInRegion->xBlockSize = xAddress - ( size_t ) pxFirstFreeBlockInRegion; - pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd; - - /* If this is not the first region that makes up the entire heap space - then link the previous region to this region. */ - if( pxPreviousFreeBlock != NULL ) - { - pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion; - } - - xTotalHeapSize += pxFirstFreeBlockInRegion->xBlockSize; - - /* Move onto the next HeapRegion_t structure. */ - xDefinedRegions++; - pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] ); - } - - xMinimumEverFreeBytesRemaining = xTotalHeapSize; - xFreeBytesRemaining = xTotalHeapSize; - - /* Check something was actually defined before it is accessed. */ - configASSERT( xTotalHeapSize ); - - /* Work out the position of the top bit in a size_t variable. */ - xBlockAllocatedBit = ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 ); -} - diff --git a/workspace/TS100/src/syscalls.c b/workspace/TS100/src/syscalls.c index eb20b429..855079c9 100644 --- a/workspace/TS100/src/syscalls.c +++ b/workspace/TS100/src/syscalls.c @@ -1,48 +1,3 @@ -/** -***************************************************************************** -** -** File : syscalls.c -** -** Abstract : System Workbench Minimal System calls file -** -** For more information about which c-functions -** need which of these lowlevel functions -** please consult the Newlib libc-manual -** -** Environment : System Workbench for MCU -** -** Distribution: The file is distributed “as is,” without any warranty -** of any kind. -** -***************************************************************************** -** -**

© COPYRIGHT(c) 2014 Ac6

-** -** Redistribution and use in source and binary forms, with or without modification, -** are permitted provided that the following conditions are met: -** 1. Redistributions of source code must retain the above copyright notice, -** this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation -** and/or other materials provided with the distribution. -** 3. Neither the name of Ac6 nor the names of its contributors -** may be used to endorse or promote products derived from this software -** without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -***************************************************************************** -*/ - /* Includes */ #include #include -- cgit v1.2.3