NaomiCreate / cnss-app

0 stars 0 forks source link

Adding STM32F10x Standard Peripherals Library #8

Closed NaomiCreate closed 3 years ago

NaomiCreate commented 3 years ago

After tying to write with C and seeing that it was to hard, we wanted to write with HAL, but we saw that it was too broad. We started reading a very helpful book- "Discovering the STM32 Microcontroller" by Geoffrey Brown, that used STM32F10x Standard Peripherals Library . We decided to try working with this library as well. Steps:

  1. We downloaded the library from this link (vs.3.5): https://www.st.com/en/embedded-software/stsw-stm32054.html
  2. Following this explanation: https://www.youtube.com/watch?v=FMg3bnORCXM&ab_channel=embryonic.dk we unzipped the library to : C:\Users\mayan\STM32Cube\Repository
  3. We added the library to the project path
  4. We included the following code to enable use of the functions to blink a LED:
    
    #define STM32F10X_MD
    /*error "Please select first the target STM32F10x device used in your application (in stm32f10x.h file)"
    * (see STM32 Features (Datasheet - production data) 2.2) */
    //#include <stm32f10x_conf.h>
    #include <stm32f10x.h>
    #include <stm32f10x_rcc.h>
    #include <stm32f10x_gpio.h>


**Problem**:
It seems that we need to configure the makefile, as noted in the book above (ctrl+F 'makefile')
mavishak commented 3 years ago

Solved: With the help of: undefined reference to `RCC_APB2PeriphClockCmd' Problem

and Download and 'install' the Standard Peripheral Library for STM8S001J3

Steps Taken:

  1. Go To Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Preprocessor -> Define symbols (-D) -> + (ADD):
  1. Go To Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU GCC Compiler -> Include paths -> + (ADD): /Note: this is default -> keep as is/ ..\Inc

    /Note: These are paths to all h files in STM32F10x_StdPeriph_Lib_V3.5.0/

    C:\Users\mayan\STM32Cube\Repository\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\CoreSupport
    C:\Users\mayan\STM32Cube\Repository\STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Template
    C:\Users\mayan\STM32Cube\Repository\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
    C:\Users\mayan\STM32Cube\Repository\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver\inc

    /Note: These are paths to STM32Cube_FW_F1_V1.8.3 default library of STM32CubeIDE -> Not needed if you are using the Standard Peripherial Lib/

    C:\Users\mayan\STM32Cube\Repository\STM32Cube_FW_F1_V1.8.3\Drivers\CMSIS\Core\Include
    C:\Users\mayan\STM32Cube\Repository\STM32Cube_FW_F1_V1.8.3\Drivers\CMSIS\Device\ST\STM32F1xx\Include
  2. These are our #includes to the main.c file:
    #include <stm32f10x.h>
    #include <stm32f10x_rcc.h>
    #include <stm32f10x_gpio.h>