STM32F407 development environment description

  1. CPU internal resources

    CPU model: STM32F407 / LQFP-176 / ARM 32-bit Cortex-M4
    Main frequency: 168MHz
    Internal Flash capacity: 1MB
    Internal SRAM capacity: 128KB SRAM+64KB CCM = 192RAM
    Timer: 17
    UART: 6
    SPI: 3 ( 2 can be reused as I2S)
    I2C: 3
    ADCs: 3 independent 12-bit ADCs
    DAC: 2 independent 12-bit DACs
    CAN: 2 CAN 2.0B
    SDIO: 1
    USB: USB2.0 full speed (integrated internal PHY ) Slave device/master device/OTG function
                                 USB2.0 high speed/full speed slave device/master device/OTG function
    GPIO: 140
    ETH: 10/100M Ethernet

  2. FSMC memory address allocation

    CPU internal FLASH [0x0800 0000-0x080F FFFF], capacity 1M (0x100000) bytes
    CPU internal SRAM1 [0x2000 0000-0x2001 FFFF], capacity 128K (0x20000) bytes
    CPU internal CCM data RAM [0x1000 0000-0x1000 FFFF], capacity 64K (0x10000) byte  
    TFT LCD address [0x6C00 0000, 0x6C00 0002], only occupy 1 port address

  3. development tools

    [Emulator] --- Non-standard, purchased separately.
        Although STM32 supports serial ISP download programs, it does not support online debugging. Using serial port to download, the development efficiency is extremely low, so it is strongly recommended to buy an emulator
        to improve development efficiency.
        -ST-LINK V2 emulator: An emulator developed by ST, which can download programs and debug and trace programs. Support STM8 and STM32.
        -J-LINK V8, V9 emulator: An emulator developed by Segger, which can download programs and debug and trace programs. Support all ARM series.
        -CMSIS-DAP simulator: ARM open source simulator, you can download programs and debug tracking programs. Support all ARM-M series.                                                                                                                                                                                         
    [Mini USB cable]
        -Development board distribution -The development board reserves a Mini USB interface, one is connected to the USART1 interface of the stm32 chip through the CH340G chip through a jumper cap, which can be used for most
      programs to print debugging information.

    [Development software]
        -Compilation environment: KEIL's MDK uVision5.17 IAR's ARM tool v7.50.2  

  4. Compilation and debugging methods

    [Keil MDK] V5.17
            -Execute the menu Project -> Open project to open \MDK-ARM\Project.uvprojx (this is the project file) -Execute the
            menu Project -> Rebuild all target files Rebuild all the files:
            -Execute the menu Flash -> Download (F8) Download the program to the development board and run
     [IAR] V7.50.2
            -Execute the menu File -> Open -> Workspace to open \EWARM\Project.eww (this is the engineering work platform file) -Execute the
            menu Project -> Rebuild all Recompile all files:
            -Execute the menu Project -> Download and Debug(Ctrl+D) to load the program and start debugging

  5. Example folder description

    ├─Drivers: Store the library provided by the third party or its source code. These codes are generally mature and verified codes.
    │ ├─CMSIS: CMSIS is defined by ARM in close cooperation with a number of different chip and software suppliers, and provides a common interface between the kernel and peripherals, real-time operating systems and intermediate devices.
    │ └─STM32F4xx_HAL_Driver: STM32F4xx series MCU hardware abstraction layer (HAL) library source code

    ├─EWARM: IAR compiler project folder

    ├─Inc: where to store the user program tasks related header files
    │ └─bsp: peripheral modules the underlying driver header file

    ├─MDK-ARM: Keil compiler project folder

    ├─Readme: engineering instructions

    └─Src: where to store the user program tasks voice C source files
        └─bsp: peripheral modules underlying driver source file

  6. Source code grouping instructions in the project

    IAR compiler environment
    └─XXX_Project: Project Name
       ├─Application: Application
       │ ├─EWARM: startup file (assembler source)
       │ └─User: main.c and stored with the user application
       │
       ├─bsp: Board Support Package , storage function module underlying drive 
       │
       ├─Drivers: driver
       │ ├─CMSIS: store only CMSIS interface file system_stm32f4xx.c)
       │ └─STM32F4xx_HAL_Driver: store the MCU STM32F4xx series of HAL library source code
       │
       ├─Readme: project documentation, Only for txt
       files└─Output: Project compilation output file
       
    Keil compilation environment└─XXX_Project
    : Target
       name├─Application/MDK-ARM: Startup file (assembly source program)
       ├─Application/User: store main.c and user programs├─Drivers
       /STM32F4xx_HAL_Driver: store the source code of the HAL library of STM32F4xx series
       MCUs├─Drivers/CMSIS: store only the CMSISI interface file system_stm32f4xx.c   
       ├─bsp: board level Support package, store the underlying driver functions of the module  
       └─Readme: project description document, only txt file

  7. Public source code file description


    -main.c : user main program, the file storing main() function -stm32f4xx_it.c: centralized storage of interrupt service routine

  8. Pre-defined macros in C compiler (change in project settings)

    USE_HAL_DRIVER-adding this symbol means using ST's HAL library peripheral driver
    VECT_TAB_SRAM-adding this symbol means that the interrupt vector table is located in the internal RAM of the CPU (need to be added for projects running in the internal RAM of the CPU, generally not used)
    STM32F407xx-add this The symbol indicates the use of STM32F407xx series chips

  9. Adjust the capacity of the heap and stack

    For IAR EWARM, you can modify it directly in the project settings
            -menu project -> options -> select Linker -> Config page -> click Edit button -> switch to Stack/Heap Size For
            example:
                CSTACK = 0x1000
                HEAP = 0x400        
            
    For KEIL MDK, setting the heap and stack size is achieved by modifying the startup file start_stm32f407xx.s, such as:
            Stack_Size EQU 0x00001000
            Heap_Size EQU 0x00000200

  10. Output target file

    For IAR EWARM:
        \EWARM\Project\Exe\Project.hex-the file compiled by IAR EWARM    
        
    For KEIL MDK:
        \MDK-ARM\Project\Project.hex-the file compiled by KEIL MDK, located in the internal Flash of the CPU    
        \MDK-ARM\Project\Project.map-This is a compiled link file, in text format, you can view the address and space allocation of each function and variable.

Guess you like

Origin blog.csdn.net/qq1291917670/article/details/114997290