├── LICENSE
├── README.md
├── document
├── QT-QP-001-07 Quectel_FAE_STM32_Cross_Building_Environment.pdf
├── Quectel_BG95_FTP(S)_Application_Note_V1.0_20231227.pdf
├── Quectel_BG95_HTTP(S)_ Application_Note_V1.0_20231225.pdf
├── Quectel_BG95_MQTT(S)_ Application_Note_V7.0_20240207.pdf
├── Quectel_BG95_PSM_Application_Note_V1.0_20240530.pdf
├── Quectel_BG95_Quick Development Manual_V2.1_20240418.pdf
├── Quectel_BG95_TCPUDP_ Application_Note_V1.1_20231129.pdf
├── Quectel_BG96&BG95&BG77&BG600L_Series_Network_Application_Note_V1.0_20240430.pdf
├── Quectel_FAE_STM32_Function_Test_Guide_V1.0_20240522.pdf
└── img
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── 6.png
│ └── 7.mp4
└── source
├── STM32F401RET6
├── .cproject
├── .gitignore
├── .mxproject
├── .project
├── .settings
│ ├── com.st.stm32cube.ide.mcu.sfrview.prefs
│ ├── language.settings.xml
│ ├── org.eclipse.core.resources.prefs
│ └── stm32cubeide.project.prefs
├── Core
│ ├── Inc
│ │ ├── FreeRTOSConfig.h
│ │ ├── main.h
│ │ ├── stm32f4xx_hal_conf.h
│ │ └── stm32f4xx_it.h
│ ├── Src
│ │ ├── freertos.c
│ │ ├── main.c
│ │ ├── stm32f4xx_hal_msp.c
│ │ ├── stm32f4xx_it.c
│ │ ├── syscalls.c
│ │ ├── sysmem.c
│ │ └── system_stm32f4xx.c
│ └── Startup
│ │ └── startup_stm32f401retx.s
├── Drivers
│ ├── CMSIS
│ │ ├── Device
│ │ │ └── ST
│ │ │ │ └── STM32F4xx
│ │ │ │ ├── Include
│ │ │ │ ├── stm32f401xe.h
│ │ │ │ ├── stm32f4xx.h
│ │ │ │ └── system_stm32f4xx.h
│ │ │ │ └── LICENSE.txt
│ │ ├── Include
│ │ │ ├── cmsis_armcc.h
│ │ │ ├── cmsis_armclang.h
│ │ │ ├── cmsis_compiler.h
│ │ │ ├── cmsis_gcc.h
│ │ │ ├── cmsis_iccarm.h
│ │ │ ├── cmsis_version.h
│ │ │ ├── core_armv8mbl.h
│ │ │ ├── core_armv8mml.h
│ │ │ ├── core_cm0.h
│ │ │ ├── core_cm0plus.h
│ │ │ ├── core_cm1.h
│ │ │ ├── core_cm23.h
│ │ │ ├── core_cm3.h
│ │ │ ├── core_cm33.h
│ │ │ ├── core_cm4.h
│ │ │ ├── core_cm7.h
│ │ │ ├── core_sc000.h
│ │ │ ├── core_sc300.h
│ │ │ ├── mpu_armv7.h
│ │ │ ├── mpu_armv8.h
│ │ │ └── tz_context.h
│ │ └── LICENSE.txt
│ └── STM32F4xx_HAL_Driver
│ │ ├── Inc
│ │ ├── Legacy
│ │ │ └── stm32_hal_legacy.h
│ │ ├── stm32f4xx_hal.h
│ │ ├── stm32f4xx_hal_cortex.h
│ │ ├── stm32f4xx_hal_def.h
│ │ ├── stm32f4xx_hal_dma.h
│ │ ├── stm32f4xx_hal_dma_ex.h
│ │ ├── stm32f4xx_hal_exti.h
│ │ ├── stm32f4xx_hal_flash.h
│ │ ├── stm32f4xx_hal_flash_ex.h
│ │ ├── stm32f4xx_hal_flash_ramfunc.h
│ │ ├── stm32f4xx_hal_gpio.h
│ │ ├── stm32f4xx_hal_gpio_ex.h
│ │ ├── stm32f4xx_hal_pwr.h
│ │ ├── stm32f4xx_hal_pwr_ex.h
│ │ ├── stm32f4xx_hal_rcc.h
│ │ ├── stm32f4xx_hal_rcc_ex.h
│ │ ├── stm32f4xx_hal_sd.h
│ │ ├── stm32f4xx_hal_spi.h
│ │ ├── stm32f4xx_hal_tim.h
│ │ ├── stm32f4xx_hal_tim_ex.h
│ │ ├── stm32f4xx_hal_uart.h
│ │ └── stm32f4xx_ll_sdmmc.h
│ │ ├── LICENSE.txt
│ │ └── Src
│ │ ├── stm32f4xx_hal.c
│ │ ├── stm32f4xx_hal_cortex.c
│ │ ├── stm32f4xx_hal_dma.c
│ │ ├── stm32f4xx_hal_dma_ex.c
│ │ ├── stm32f4xx_hal_exti.c
│ │ ├── stm32f4xx_hal_flash.c
│ │ ├── stm32f4xx_hal_flash_ex.c
│ │ ├── stm32f4xx_hal_flash_ramfunc.c
│ │ ├── stm32f4xx_hal_gpio.c
│ │ ├── stm32f4xx_hal_pwr.c
│ │ ├── stm32f4xx_hal_pwr_ex.c
│ │ ├── stm32f4xx_hal_rcc.c
│ │ ├── stm32f4xx_hal_rcc_ex.c
│ │ ├── stm32f4xx_hal_sd.c
│ │ ├── stm32f4xx_hal_spi.c
│ │ ├── stm32f4xx_hal_tim.c
│ │ ├── stm32f4xx_hal_tim_ex.c
│ │ ├── stm32f4xx_hal_uart.c
│ │ └── stm32f4xx_ll_sdmmc.c
├── FATFS
│ ├── App
│ │ ├── fatfs.c
│ │ └── fatfs.h
│ └── Target
│ │ ├── bsp_driver_sd.c
│ │ ├── bsp_driver_sd.h
│ │ ├── ffconf.h
│ │ ├── sd_diskio.c
│ │ └── sd_diskio.h
├── Middlewares
│ └── Third_Party
│ │ ├── FatFs
│ │ └── src
│ │ │ ├── diskio.c
│ │ │ ├── diskio.h
│ │ │ ├── ff.c
│ │ │ ├── ff.h
│ │ │ ├── ff_gen_drv.c
│ │ │ ├── ff_gen_drv.h
│ │ │ ├── integer.h
│ │ │ └── option
│ │ │ └── syscall.c
│ │ └── FreeRTOS
│ │ └── Source
│ │ ├── CMSIS_RTOS_V2
│ │ ├── cmsis_os.h
│ │ ├── cmsis_os2.c
│ │ ├── cmsis_os2.h
│ │ ├── freertos_mpool.h
│ │ └── freertos_os2.h
│ │ ├── LICENSE
│ │ ├── croutine.c
│ │ ├── event_groups.c
│ │ ├── include
│ │ ├── FreeRTOS.h
│ │ ├── StackMacros.h
│ │ ├── atomic.h
│ │ ├── croutine.h
│ │ ├── deprecated_definitions.h
│ │ ├── event_groups.h
│ │ ├── list.h
│ │ ├── message_buffer.h
│ │ ├── mpu_prototypes.h
│ │ ├── mpu_wrappers.h
│ │ ├── portable.h
│ │ ├── projdefs.h
│ │ ├── queue.h
│ │ ├── semphr.h
│ │ ├── stack_macros.h
│ │ ├── stream_buffer.h
│ │ ├── task.h
│ │ └── timers.h
│ │ ├── list.c
│ │ ├── portable
│ │ ├── GCC
│ │ │ └── ARM_CM4F
│ │ │ │ ├── port.c
│ │ │ │ └── portmacro.h
│ │ └── MemMang
│ │ │ └── heap_4.c
│ │ ├── queue.c
│ │ ├── stream_buffer.c
│ │ ├── tasks.c
│ │ └── timers.c
├── Quectel
│ ├── QuectelConfig.h
│ ├── at_device
│ │ ├── bg95
│ │ │ ├── bg95_filesystem.c
│ │ │ ├── bg95_filesystem.h
│ │ │ ├── bg95_ftp.c
│ │ │ ├── bg95_ftp.h
│ │ │ ├── bg95_http.c
│ │ │ ├── bg95_http.h
│ │ │ ├── bg95_mqtt.c
│ │ │ ├── bg95_mqtt.h
│ │ │ ├── bg95_mqtt_handler.c
│ │ │ ├── bg95_mqtt_handler.h
│ │ │ ├── bg95_net.c
│ │ │ ├── bg95_net.h
│ │ │ ├── bg95_psm.c
│ │ │ ├── bg95_psm.h
│ │ │ ├── bg95_socket.c
│ │ │ ├── bg95_socket.h
│ │ │ ├── bg95_ssl.c
│ │ │ └── bg95_ssl.h
│ │ └── ec20
│ │ │ ├── ec20_net.c
│ │ │ ├── ec20_net.h
│ │ │ ├── ec20_socket.c
│ │ │ └── ec20_socket.h
│ ├── common
│ │ ├── inc
│ │ │ ├── at_osal.h
│ │ │ ├── broadcast_service.h
│ │ │ ├── debug_service.h
│ │ │ ├── ringbuffer.h
│ │ │ └── sd_fatfs.h
│ │ └── src
│ │ │ ├── at_osal.c
│ │ │ ├── broadcast_service.c
│ │ │ ├── debug_service.c
│ │ │ ├── hardware_init.c
│ │ │ ├── ringbuffer.c
│ │ │ └── sd_fatfs.c
│ ├── custom
│ │ ├── fs
│ │ │ ├── example_fs.c
│ │ │ └── example_fs.h
│ │ ├── ftp
│ │ │ ├── example_ftp.c
│ │ │ └── example_ftp.h
│ │ ├── http
│ │ │ ├── example_http.c
│ │ │ └── example_http.h
│ │ ├── mqtt
│ │ │ ├── example_mqtt.c
│ │ │ └── example_mqtt.h
│ │ ├── network
│ │ │ ├── example_network.c
│ │ │ └── example_network.h
│ │ ├── psm
│ │ │ ├── example_psm.c
│ │ │ └── example_psm.h
│ │ ├── sockets
│ │ │ ├── example_tcp.c
│ │ │ ├── example_tcp.h
│ │ │ ├── example_tcp_server.c
│ │ │ ├── example_tcp_server.h
│ │ │ ├── example_udp.c
│ │ │ ├── example_udp.h
│ │ │ ├── example_udp_server.c
│ │ │ └── example_udp_server.h
│ │ ├── user_main.c
│ │ └── user_main.h
│ └── third_party
│ │ ├── AT plugins from rt-thread-v4.0.2
│ │ ├── at_client
│ │ ├── include
│ │ │ ├── at.h
│ │ │ └── at_log.h
│ │ └── src
│ │ │ ├── at_client.c
│ │ │ └── at_utils.c
│ │ └── at_socket
│ │ ├── at_socket.c
│ │ ├── at_socket.h
│ │ ├── at_socket_device.c
│ │ └── at_socket_device.h
├── STM32F401RET6U_CubleIDE_FreeRTOS Debug.launch
├── STM32F401RET6U_CubleIDE_FreeRTOS.ioc
├── STM32F401RETX_FLASH.ld
└── STM32F401RETX_RAM.ld
└── STM32F401RET6_IAP
├── .cproject
├── .gitignore
├── .mxproject
├── .project
├── .settings
├── com.st.stm32cube.ide.mcu.sfrview.prefs
├── language.settings.xml
├── org.eclipse.cdt.core.prefs
└── stm32cubeide.project.prefs
├── Core
├── Inc
│ ├── main.h
│ ├── stm32f4xx_hal_conf.h
│ └── stm32f4xx_it.h
├── Src
│ ├── main.c
│ ├── stm32f4xx_hal_msp.c
│ ├── stm32f4xx_it.c
│ ├── syscalls.c
│ ├── sysmem.c
│ └── system_stm32f4xx.c
└── Startup
│ └── startup_stm32f401retx.s
├── Drivers
├── CMSIS
│ ├── Device
│ │ └── ST
│ │ │ └── STM32F4xx
│ │ │ ├── Include
│ │ │ ├── stm32f401xe.h
│ │ │ ├── stm32f4xx.h
│ │ │ └── system_stm32f4xx.h
│ │ │ └── LICENSE.txt
│ ├── Include
│ │ ├── cmsis_armcc.h
│ │ ├── cmsis_armclang.h
│ │ ├── cmsis_compiler.h
│ │ ├── cmsis_gcc.h
│ │ ├── cmsis_iccarm.h
│ │ ├── cmsis_version.h
│ │ ├── core_armv8mbl.h
│ │ ├── core_armv8mml.h
│ │ ├── core_cm0.h
│ │ ├── core_cm0plus.h
│ │ ├── core_cm1.h
│ │ ├── core_cm23.h
│ │ ├── core_cm3.h
│ │ ├── core_cm33.h
│ │ ├── core_cm4.h
│ │ ├── core_cm7.h
│ │ ├── core_sc000.h
│ │ ├── core_sc300.h
│ │ ├── mpu_armv7.h
│ │ ├── mpu_armv8.h
│ │ └── tz_context.h
│ └── LICENSE.txt
└── STM32F4xx_HAL_Driver
│ ├── Inc
│ ├── Legacy
│ │ └── stm32_hal_legacy.h
│ ├── stm32f4xx_hal.h
│ ├── stm32f4xx_hal_cortex.h
│ ├── stm32f4xx_hal_def.h
│ ├── stm32f4xx_hal_dma.h
│ ├── stm32f4xx_hal_dma_ex.h
│ ├── stm32f4xx_hal_exti.h
│ ├── stm32f4xx_hal_flash.h
│ ├── stm32f4xx_hal_flash_ex.h
│ ├── stm32f4xx_hal_flash_ramfunc.h
│ ├── stm32f4xx_hal_gpio.h
│ ├── stm32f4xx_hal_gpio_ex.h
│ ├── stm32f4xx_hal_pwr.h
│ ├── stm32f4xx_hal_pwr_ex.h
│ ├── stm32f4xx_hal_rcc.h
│ ├── stm32f4xx_hal_rcc_ex.h
│ ├── stm32f4xx_hal_sd.h
│ ├── stm32f4xx_hal_tim.h
│ ├── stm32f4xx_hal_tim_ex.h
│ ├── stm32f4xx_hal_uart.h
│ └── stm32f4xx_ll_sdmmc.h
│ ├── LICENSE.txt
│ └── Src
│ ├── stm32f4xx_hal.c
│ ├── stm32f4xx_hal_cortex.c
│ ├── stm32f4xx_hal_dma.c
│ ├── stm32f4xx_hal_dma_ex.c
│ ├── stm32f4xx_hal_exti.c
│ ├── stm32f4xx_hal_flash.c
│ ├── stm32f4xx_hal_flash_ex.c
│ ├── stm32f4xx_hal_flash_ramfunc.c
│ ├── stm32f4xx_hal_gpio.c
│ ├── stm32f4xx_hal_pwr.c
│ ├── stm32f4xx_hal_pwr_ex.c
│ ├── stm32f4xx_hal_rcc.c
│ ├── stm32f4xx_hal_rcc_ex.c
│ ├── stm32f4xx_hal_sd.c
│ ├── stm32f4xx_hal_tim.c
│ ├── stm32f4xx_hal_tim_ex.c
│ ├── stm32f4xx_hal_uart.c
│ └── stm32f4xx_ll_sdmmc.c
├── FATFS
├── App
│ ├── fatfs.c
│ └── fatfs.h
└── Target
│ ├── bsp_driver_sd.c
│ ├── bsp_driver_sd.h
│ ├── fatfs_platform.c
│ ├── fatfs_platform.h
│ ├── ffconf.h
│ ├── sd_diskio.c
│ └── sd_diskio.h
├── Middlewares
└── Third_Party
│ └── FatFs
│ └── src
│ ├── diskio.c
│ ├── diskio.h
│ ├── ff.c
│ ├── ff.h
│ ├── ff_gen_drv.c
│ ├── ff_gen_drv.h
│ ├── integer.h
│ └── option
│ └── syscall.c
├── Quectel
└── bootloader
│ ├── bootloader.c
│ └── bootloader.h
├── STM32F401RET6U_CubleIDE_IAP Debug.launch
├── STM32F401RET6U_CubleIDE_IAP.ioc
├── STM32F401RETX_FLASH.ld
└── STM32F401RETX_RAM.ld
/README.md:
--------------------------------------------------------------------------------
1 | # Quectel-User-Friendly-Development
2 | Quectel module products are powerful,However,not all user are familiar with the use of AT commands. So,we have meticulously developed a comprehensive SDK that encapsulates complex AT commands. Our vision is to simplify the interaction between user and the module through this SDK,without needing in-depth knowledge of the underlying AT commands
3 |
4 | # Hardware and Tools Preparation
5 | 
6 |
7 | # Hardware and Tools
8 | 
9 |
10 | # Hardware and Tools Preparation
11 | 
12 | 
13 | # Software Tools
14 | Code compilation: Download STM32CubeIDE from ST website:
15 | https://www.st.com/content/st_com/zh/stm32cubeide.html
16 | Firmware download :STM32 official recommended free tool STM32CubeProgrammer
17 | https://www.st.com/zh/development-tools/stm32cubeprog.html
18 |
19 | # Overview of The Five-Layer Structure
20 | 
21 | # Test Environment Preparation
22 | 
23 | # TEST VIDEO
24 |
--------------------------------------------------------------------------------
/document/QT-QP-001-07 Quectel_FAE_STM32_Cross_Building_Environment.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/QT-QP-001-07 Quectel_FAE_STM32_Cross_Building_Environment.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG95_FTP(S)_Application_Note_V1.0_20231227.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG95_FTP(S)_Application_Note_V1.0_20231227.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG95_HTTP(S)_ Application_Note_V1.0_20231225.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG95_HTTP(S)_ Application_Note_V1.0_20231225.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG95_MQTT(S)_ Application_Note_V7.0_20240207.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG95_MQTT(S)_ Application_Note_V7.0_20240207.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG95_PSM_Application_Note_V1.0_20240530.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG95_PSM_Application_Note_V1.0_20240530.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG95_Quick Development Manual_V2.1_20240418.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG95_Quick Development Manual_V2.1_20240418.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG95_TCPUDP_ Application_Note_V1.1_20231129.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG95_TCPUDP_ Application_Note_V1.1_20231129.pdf
--------------------------------------------------------------------------------
/document/Quectel_BG96&BG95&BG77&BG600L_Series_Network_Application_Note_V1.0_20240430.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_BG96&BG95&BG77&BG600L_Series_Network_Application_Note_V1.0_20240430.pdf
--------------------------------------------------------------------------------
/document/Quectel_FAE_STM32_Function_Test_Guide_V1.0_20240522.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/Quectel_FAE_STM32_Function_Test_Guide_V1.0_20240522.pdf
--------------------------------------------------------------------------------
/document/img/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/1.png
--------------------------------------------------------------------------------
/document/img/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/2.png
--------------------------------------------------------------------------------
/document/img/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/3.png
--------------------------------------------------------------------------------
/document/img/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/4.png
--------------------------------------------------------------------------------
/document/img/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/5.png
--------------------------------------------------------------------------------
/document/img/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/6.png
--------------------------------------------------------------------------------
/document/img/7.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/document/img/7.mp4
--------------------------------------------------------------------------------
/source/STM32F401RET6/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | /Debug/*
--------------------------------------------------------------------------------
/source/STM32F401RET6/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | STM32F401RET6U_CubleIDE_FreeRTOS
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | com.st.stm32cube.ide.mcu.MCUProjectNature
23 | com.st.stm32cube.ide.mcu.MCUCubeProjectNature
24 | org.eclipse.cdt.core.cnature
25 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature
26 | com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature
27 | com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature
28 | com.st.stm32cube.ide.mcu.MCURootProjectNature
29 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
30 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
31 |
32 |
33 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/.settings/com.st.stm32cube.ide.mcu.sfrview.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | sfrviewstate={"fFavorites"\:{"fLists"\:{}},"fProperties"\:{"fNodeProperties"\:{}}}
3 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/.settings/stm32cubeide.project.prefs:
--------------------------------------------------------------------------------
1 | 2F62501ED4689FB349E356AB974DBE57=880BC74D5A92AACD13E8EED1E25BB2E6
2 | 635E684B79701B039C64EA45C3F84D30=AA64C45D13CBDFAA374D38A08C4DB5C8
3 | 66BE74F758C12D739921AEA421D593D3=1
4 | 8DF89ED150041C4CBC7CB9A9CAA90856=880BC74D5A92AACD13E8EED1E25BB2E6
5 | DC22A860405A8BF2F2C095E5B6529F12=71D3CAC97A2D0AF4151C15D93F5DE672
6 | eclipse.preferences.version=1
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Core/Inc/main.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : main.h
5 | * @brief : Header for main.c file.
6 | * This file contains the common defines of the application.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * Copyright (c) 2023 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software is licensed under terms that can be found in the LICENSE file
14 | * in the root directory of this software component.
15 | * If no LICENSE file comes with this software, it is provided AS-IS.
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __MAIN_H
23 | #define __MAIN_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Includes ------------------------------------------------------------------*/
30 | #include "stm32f4xx_hal.h"
31 |
32 | /* Private includes ----------------------------------------------------------*/
33 | /* USER CODE BEGIN Includes */
34 |
35 | /* USER CODE END Includes */
36 |
37 | /* Exported types ------------------------------------------------------------*/
38 | /* USER CODE BEGIN ET */
39 |
40 | /* USER CODE END ET */
41 |
42 | /* Exported constants --------------------------------------------------------*/
43 | /* USER CODE BEGIN EC */
44 |
45 | /* USER CODE END EC */
46 |
47 | /* Exported macro ------------------------------------------------------------*/
48 | /* USER CODE BEGIN EM */
49 |
50 | /* USER CODE END EM */
51 |
52 | /* Exported functions prototypes ---------------------------------------------*/
53 | void Error_Handler(void);
54 |
55 | /* USER CODE BEGIN EFP */
56 |
57 | /* USER CODE END EFP */
58 |
59 | /* Private defines -----------------------------------------------------------*/
60 | /* USER CODE BEGIN Private defines */
61 |
62 | /* USER CODE END Private defines */
63 |
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 |
68 | #endif /* __MAIN_H */
69 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Core/Inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file stm32f4xx_it.h
5 | * @brief This file contains the headers of the interrupt handlers.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2023 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4xx_IT_H
22 | #define __STM32F4xx_IT_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Private includes ----------------------------------------------------------*/
29 | /* USER CODE BEGIN Includes */
30 |
31 | /* USER CODE END Includes */
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 | /* USER CODE BEGIN ET */
35 |
36 | /* USER CODE END ET */
37 |
38 | /* Exported constants --------------------------------------------------------*/
39 | /* USER CODE BEGIN EC */
40 |
41 | /* USER CODE END EC */
42 |
43 | /* Exported macro ------------------------------------------------------------*/
44 | /* USER CODE BEGIN EM */
45 |
46 | /* USER CODE END EM */
47 |
48 | /* Exported functions prototypes ---------------------------------------------*/
49 | void NMI_Handler(void);
50 | void HardFault_Handler(void);
51 | void MemManage_Handler(void);
52 | void BusFault_Handler(void);
53 | void UsageFault_Handler(void);
54 | void DebugMon_Handler(void);
55 | void SysTick_Handler(void);
56 | void EXTI1_IRQHandler(void);
57 | void EXTI2_IRQHandler(void);
58 | void DMA1_Stream5_IRQHandler(void);
59 | void DMA1_Stream6_IRQHandler(void);
60 | void EXTI9_5_IRQHandler(void);
61 | void USART2_IRQHandler(void);
62 | void SDIO_IRQHandler(void);
63 | void DMA2_Stream3_IRQHandler(void);
64 | void DMA2_Stream6_IRQHandler(void);
65 | void USART6_IRQHandler(void);
66 | /* USER CODE BEGIN EFP */
67 |
68 | /* USER CODE END EFP */
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif /* __STM32F4xx_IT_H */
75 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Core/Src/freertos.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * File Name : freertos.c
5 | * Description : Code for freertos applications
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2023 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 |
20 | /* Includes ------------------------------------------------------------------*/
21 | #include "FreeRTOS.h"
22 | #include "task.h"
23 | #include "main.h"
24 |
25 | /* Private includes ----------------------------------------------------------*/
26 | /* USER CODE BEGIN Includes */
27 |
28 | /* USER CODE END Includes */
29 |
30 | /* Private typedef -----------------------------------------------------------*/
31 | /* USER CODE BEGIN PTD */
32 |
33 | /* USER CODE END PTD */
34 |
35 | /* Private define ------------------------------------------------------------*/
36 | /* USER CODE BEGIN PD */
37 |
38 | /* USER CODE END PD */
39 |
40 | /* Private macro -------------------------------------------------------------*/
41 | /* USER CODE BEGIN PM */
42 |
43 | /* USER CODE END PM */
44 |
45 | /* Private variables ---------------------------------------------------------*/
46 | /* USER CODE BEGIN Variables */
47 |
48 | /* USER CODE END Variables */
49 |
50 | /* Private function prototypes -----------------------------------------------*/
51 | /* USER CODE BEGIN FunctionPrototypes */
52 |
53 | /* USER CODE END FunctionPrototypes */
54 |
55 | /* Hook prototypes */
56 | void configureTimerForRunTimeStats(void);
57 | unsigned long getRunTimeCounterValue(void);
58 |
59 | /* USER CODE BEGIN 1 */
60 | /* Functions needed when configGENERATE_RUN_TIME_STATS is on */
61 | __weak void configureTimerForRunTimeStats(void)
62 | {
63 |
64 | }
65 |
66 | __weak unsigned long getRunTimeCounterValue(void)
67 | {
68 | return 0;
69 | }
70 | /* USER CODE END 1 */
71 |
72 | /* Private application code --------------------------------------------------*/
73 | /* USER CODE BEGIN Application */
74 |
75 | /* USER CODE END Application */
76 |
77 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Core/Src/syscalls.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file syscalls.c
4 | * @author Auto-generated by STM32CubeIDE
5 | * @brief STM32CubeIDE Minimal System calls file
6 | *
7 | * For more information about which c-functions
8 | * need which of these lowlevel functions
9 | * please consult the Newlib libc-manual
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * Copyright (c) 2020-2023 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software is licensed under terms that can be found in the LICENSE file
17 | * in the root directory of this software component.
18 | * If no LICENSE file comes with this software, it is provided AS-IS.
19 | *
20 | ******************************************************************************
21 | */
22 |
23 | /* Includes */
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 |
34 | /* Variables */
35 | extern int __io_putchar(int ch) __attribute__((weak));
36 | extern int __io_getchar(void) __attribute__((weak));
37 |
38 |
39 | char *__env[1] = { 0 };
40 | char **environ = __env;
41 |
42 |
43 | /* Functions */
44 | void initialise_monitor_handles()
45 | {
46 | }
47 |
48 | int _getpid(void)
49 | {
50 | return 1;
51 | }
52 |
53 | int _kill(int pid, int sig)
54 | {
55 | (void)pid;
56 | (void)sig;
57 | errno = EINVAL;
58 | return -1;
59 | }
60 |
61 | void _exit (int status)
62 | {
63 | _kill(status, -1);
64 | while (1) {} /* Make sure we hang here */
65 | }
66 |
67 | __attribute__((weak)) int _read(int file, char *ptr, int len)
68 | {
69 | (void)file;
70 | int DataIdx;
71 |
72 | for (DataIdx = 0; DataIdx < len; DataIdx++)
73 | {
74 | *ptr++ = __io_getchar();
75 | }
76 |
77 | return len;
78 | }
79 |
80 | __attribute__((weak)) int _write(int file, char *ptr, int len)
81 | {
82 | (void)file;
83 | int DataIdx;
84 |
85 | for (DataIdx = 0; DataIdx < len; DataIdx++)
86 | {
87 | __io_putchar(*ptr++);
88 | }
89 | return len;
90 | }
91 |
92 | int _close(int file)
93 | {
94 | (void)file;
95 | return -1;
96 | }
97 |
98 |
99 | int _fstat(int file, struct stat *st)
100 | {
101 | (void)file;
102 | st->st_mode = S_IFCHR;
103 | return 0;
104 | }
105 |
106 | int _isatty(int file)
107 | {
108 | (void)file;
109 | return 1;
110 | }
111 |
112 | int _lseek(int file, int ptr, int dir)
113 | {
114 | (void)file;
115 | (void)ptr;
116 | (void)dir;
117 | return 0;
118 | }
119 |
120 | int _open(char *path, int flags, ...)
121 | {
122 | (void)path;
123 | (void)flags;
124 | /* Pretend like we always fail */
125 | return -1;
126 | }
127 |
128 | int _wait(int *status)
129 | {
130 | (void)status;
131 | errno = ECHILD;
132 | return -1;
133 | }
134 |
135 | int _unlink(char *name)
136 | {
137 | (void)name;
138 | errno = ENOENT;
139 | return -1;
140 | }
141 |
142 | int _times(struct tms *buf)
143 | {
144 | (void)buf;
145 | return -1;
146 | }
147 |
148 | int _stat(char *file, struct stat *st)
149 | {
150 | (void)file;
151 | st->st_mode = S_IFCHR;
152 | return 0;
153 | }
154 |
155 | int _link(char *old, char *new)
156 | {
157 | (void)old;
158 | (void)new;
159 | errno = EMLINK;
160 | return -1;
161 | }
162 |
163 | int _fork(void)
164 | {
165 | errno = EAGAIN;
166 | return -1;
167 | }
168 |
169 | int _execve(char *name, char **argv, char **env)
170 | {
171 | (void)name;
172 | (void)argv;
173 | (void)env;
174 | errno = ENOMEM;
175 | return -1;
176 | }
177 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Core/Src/sysmem.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file sysmem.c
4 | * @author Generated by STM32CubeIDE
5 | * @brief STM32CubeIDE System Memory calls file
6 | *
7 | * For more information about which C functions
8 | * need which of these lowlevel functions
9 | * please consult the newlib libc manual
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * Copyright (c) 2023 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software is licensed under terms that can be found in the LICENSE file
17 | * in the root directory of this software component.
18 | * If no LICENSE file comes with this software, it is provided AS-IS.
19 | *
20 | ******************************************************************************
21 | */
22 |
23 | /* Includes */
24 | #include
25 | #include
26 |
27 | /**
28 | * Pointer to the current high watermark of the heap usage
29 | */
30 | static uint8_t *__sbrk_heap_end = NULL;
31 |
32 | /**
33 | * @brief _sbrk() allocates memory to the newlib heap and is used by malloc
34 | * and others from the C library
35 | *
36 | * @verbatim
37 | * ############################################################################
38 | * # .data # .bss # newlib heap # MSP stack #
39 | * # # # # Reserved by _Min_Stack_Size #
40 | * ############################################################################
41 | * ^-- RAM start ^-- _end _estack, RAM end --^
42 | * @endverbatim
43 | *
44 | * This implementation starts allocating at the '_end' linker symbol
45 | * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack
46 | * The implementation considers '_estack' linker symbol to be RAM end
47 | * NOTE: If the MSP stack, at any point during execution, grows larger than the
48 | * reserved size, please increase the '_Min_Stack_Size'.
49 | *
50 | * @param incr Memory size
51 | * @return Pointer to allocated memory
52 | */
53 | void *_sbrk(ptrdiff_t incr)
54 | {
55 | extern uint8_t _end; /* Symbol defined in the linker script */
56 | extern uint8_t _estack; /* Symbol defined in the linker script */
57 | extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */
58 | const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
59 | const uint8_t *max_heap = (uint8_t *)stack_limit;
60 | uint8_t *prev_heap_end;
61 |
62 | /* Initialize heap end at first call */
63 | if (NULL == __sbrk_heap_end)
64 | {
65 | __sbrk_heap_end = &_end;
66 | }
67 |
68 | /* Protect heap from growing into the reserved MSP stack */
69 | if (__sbrk_heap_end + incr > max_heap)
70 | {
71 | errno = ENOMEM;
72 | return (void *)-1;
73 | }
74 |
75 | prev_heap_end = __sbrk_heap_end;
76 | __sbrk_heap_end += incr;
77 |
78 | return (void *)prev_heap_end;
79 | }
80 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.h
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /** @addtogroup CMSIS
20 | * @{
21 | */
22 |
23 | /** @addtogroup stm32f4xx_system
24 | * @{
25 | */
26 |
27 | /**
28 | * @brief Define to prevent recursive inclusion
29 | */
30 | #ifndef __SYSTEM_STM32F4XX_H
31 | #define __SYSTEM_STM32F4XX_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /** @addtogroup STM32F4xx_System_Includes
38 | * @{
39 | */
40 |
41 | /**
42 | * @}
43 | */
44 |
45 |
46 | /** @addtogroup STM32F4xx_System_Exported_types
47 | * @{
48 | */
49 | /* This variable is updated in three ways:
50 | 1) by calling CMSIS function SystemCoreClockUpdate()
51 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq()
52 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
53 | Note: If you use this function to configure the system clock; then there
54 | is no need to call the 2 first functions listed above, since SystemCoreClock
55 | variable is updated automatically.
56 | */
57 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
58 |
59 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
60 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /** @addtogroup STM32F4xx_System_Exported_Constants
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /** @addtogroup STM32F4xx_System_Exported_Macros
75 | * @{
76 | */
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | /** @addtogroup STM32F4xx_System_Exported_Functions
83 | * @{
84 | */
85 |
86 | extern void SystemInit(void);
87 | extern void SystemCoreClockUpdate(void);
88 | /**
89 | * @}
90 | */
91 |
92 | #ifdef __cplusplus
93 | }
94 | #endif
95 |
96 | #endif /*__SYSTEM_STM32F4XX_H */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /**
103 | * @}
104 | */
105 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/CMSIS/Device/ST/STM32F4xx/LICENSE.txt:
--------------------------------------------------------------------------------
1 | This software component is provided to you as part of a software package and
2 | applicable license terms are in the Package_license file. If you received this
3 | software component outside of a package or without applicable license terms,
4 | the terms of the Apache-2.0 license shall apply.
5 | You may obtain a copy of the Apache-2.0 at:
6 | https://opensource.org/licenses/Apache-2.0
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/CMSIS/Include/cmsis_version.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file cmsis_version.h
3 | * @brief CMSIS Core(M) Version definitions
4 | * @version V5.0.2
5 | * @date 19. April 2017
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef __CMSIS_VERSION_H
32 | #define __CMSIS_VERSION_H
33 |
34 | /* CMSIS Version definitions */
35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */
37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
39 | #endif
40 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/CMSIS/Include/tz_context.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file tz_context.h
3 | * @brief Context Management for Armv8-M TrustZone
4 | * @version V1.0.1
5 | * @date 10. January 2018
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef TZ_CONTEXT_H
32 | #define TZ_CONTEXT_H
33 |
34 | #include
35 |
36 | #ifndef TZ_MODULEID_T
37 | #define TZ_MODULEID_T
38 | /// \details Data type that identifies secure software modules called by a process.
39 | typedef uint32_t TZ_ModuleId_t;
40 | #endif
41 |
42 | /// \details TZ Memory ID identifies an allocated memory slot.
43 | typedef uint32_t TZ_MemoryId_t;
44 |
45 | /// Initialize secure context memory system
46 | /// \return execution status (1: success, 0: error)
47 | uint32_t TZ_InitContextSystem_S (void);
48 |
49 | /// Allocate context memory for calling secure software modules in TrustZone
50 | /// \param[in] module identifies software modules called from non-secure mode
51 | /// \return value != 0 id TrustZone memory slot identifier
52 | /// \return value 0 no memory available or internal error
53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
54 |
55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
56 | /// \param[in] id TrustZone memory slot identifier
57 | /// \return execution status (1: success, 0: error)
58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
59 |
60 | /// Load secure context (called on RTOS thread context switch)
61 | /// \param[in] id TrustZone memory slot identifier
62 | /// \return execution status (1: success, 0: error)
63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
64 |
65 | /// Store secure context (called on RTOS thread context switch)
66 | /// \param[in] id TrustZone memory slot identifier
67 | /// \return execution status (1: success, 0: error)
68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
69 |
70 | #endif // TZ_CONTEXT_H
71 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_dma_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of DMA HAL extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file in
13 | * the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __STM32F4xx_HAL_DMA_EX_H
21 | #define __STM32F4xx_HAL_DMA_EX_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32f4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32F4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup DMAEx
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /** @defgroup DMAEx_Exported_Types DMAEx Exported Types
40 | * @brief DMAEx Exported types
41 | * @{
42 | */
43 |
44 | /**
45 | * @brief HAL DMA Memory definition
46 | */
47 | typedef enum
48 | {
49 | MEMORY0 = 0x00U, /*!< Memory 0 */
50 | MEMORY1 = 0x01U /*!< Memory 1 */
51 | }HAL_DMA_MemoryTypeDef;
52 |
53 | /**
54 | * @}
55 | */
56 |
57 | /* Exported functions --------------------------------------------------------*/
58 | /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions
59 | * @brief DMAEx Exported functions
60 | * @{
61 | */
62 |
63 | /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions
64 | * @brief Extended features functions
65 | * @{
66 | */
67 |
68 | /* IO operation functions *******************************************************/
69 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
70 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
71 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory);
72 |
73 | /**
74 | * @}
75 | */
76 | /**
77 | * @}
78 | */
79 |
80 | /* Private functions ---------------------------------------------------------*/
81 | /** @defgroup DMAEx_Private_Functions DMAEx Private Functions
82 | * @brief DMAEx Private functions
83 | * @{
84 | */
85 | /**
86 | * @}
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /**
94 | * @}
95 | */
96 |
97 | #ifdef __cplusplus
98 | }
99 | #endif
100 |
101 | #endif /*__STM32F4xx_HAL_DMA_EX_H*/
102 |
103 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_flash_ramfunc.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH RAMFUNC driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file in
13 | * the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | ******************************************************************************
16 | */
17 |
18 | /* Define to prevent recursive inclusion -------------------------------------*/
19 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H
20 | #define __STM32F4xx_FLASH_RAMFUNC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
26 | defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32F4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup FLASH_RAMFUNC
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported macro ------------------------------------------------------------*/
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
47 | * @{
48 | */
49 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void);
50 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void);
51 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void);
52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void);
53 | /**
54 | * @}
55 | */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 |
75 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */
76 |
77 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Drivers/STM32F4xx_HAL_Driver/LICENSE.txt:
--------------------------------------------------------------------------------
1 | This software component is provided to you as part of a software package and
2 | applicable license terms are in the Package_license file. If you received this
3 | software component outside of a package or without applicable license terms,
4 | the terms of the BSD-3-Clause license shall apply.
5 | You may obtain a copy of the BSD-3-Clause at:
6 | https://opensource.org/licenses/BSD-3-Clause
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/FATFS/App/fatfs.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file fatfs.c
5 | * @brief Code for fatfs applications
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 | #include "fatfs.h"
20 |
21 | uint8_t retSD; /* Return value for SD */
22 | char SDPath[4]; /* SD logical drive path */
23 | FATFS SDFatFS; /* File system object for SD logical drive */
24 | FIL SDFile; /* File object for SD */
25 |
26 | /* USER CODE BEGIN Variables */
27 |
28 | /* USER CODE END Variables */
29 |
30 | void MX_FATFS_Init(void)
31 | {
32 | /*## FatFS: Link the SD driver ###########################*/
33 | retSD = FATFS_LinkDriver(&SD_Driver, SDPath);
34 |
35 | /* USER CODE BEGIN Init */
36 | /* additional user code for init */
37 | /* USER CODE END Init */
38 | }
39 |
40 | /**
41 | * @brief Gets Time from RTC
42 | * @param None
43 | * @retval Time in DWORD
44 | */
45 | DWORD get_fattime(void)
46 | {
47 | /* USER CODE BEGIN get_fattime */
48 | return 0;
49 | /* USER CODE END get_fattime */
50 | }
51 |
52 | /* USER CODE BEGIN Application */
53 |
54 | /* USER CODE END Application */
55 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/FATFS/App/fatfs.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file fatfs.h
5 | * @brief Header for fatfs applications
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __fatfs_H
21 | #define __fatfs_H
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include "ff.h"
27 | #include "ff_gen_drv.h"
28 | #include "sd_diskio.h" /* defines SD_Driver as external */
29 |
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | extern uint8_t retSD; /* Return value for SD */
35 | extern char SDPath[4]; /* SD logical drive path */
36 | extern FATFS SDFatFS; /* File system object for SD logical drive */
37 | extern FIL SDFile; /* File object for SD */
38 |
39 | void MX_FATFS_Init(void);
40 |
41 | /* USER CODE BEGIN Prototypes */
42 |
43 | /* USER CODE END Prototypes */
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 | #endif /*__fatfs_H */
48 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/FATFS/Target/bsp_driver_sd.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file bsp_driver_sd.h for F4 (based on stm324x9i_eval_sd.h)
5 | * @brief This file contains the common defines and functions prototypes for
6 | * the bsp_driver_sd.c driver.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * Copyright (c) 2024 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software is licensed under terms that can be found in the LICENSE file
14 | * in the root directory of this software component.
15 | * If no LICENSE file comes with this software, it is provided AS-IS.
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4_SD_H
22 | #define __STM32F4_SD_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal.h"
30 |
31 | /* Exported types --------------------------------------------------------*/
32 | /**
33 | * @brief SD Card information structure
34 | */
35 | #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
36 |
37 | /* Exported constants --------------------------------------------------------*/
38 | /**
39 | * @brief SD status structure definition
40 | */
41 | #define MSD_OK ((uint8_t)0x00)
42 | #define MSD_ERROR ((uint8_t)0x01)
43 |
44 | /**
45 | * @brief SD transfer state definition
46 | */
47 | #define SD_TRANSFER_OK ((uint8_t)0x00)
48 | #define SD_TRANSFER_BUSY ((uint8_t)0x01)
49 |
50 | #define SD_PRESENT ((uint8_t)0x01)
51 | #define SD_NOT_PRESENT ((uint8_t)0x00)
52 | #define SD_DATATIMEOUT ((uint32_t)100000000)
53 |
54 | #ifdef OLD_API
55 | /* kept to avoid issue when migrating old projects. */
56 | /* USER CODE BEGIN 0 */
57 |
58 | /* USER CODE END 0 */
59 | #else
60 | /* USER CODE BEGIN BSP_H_CODE */
61 | /* Exported functions --------------------------------------------------------*/
62 | uint8_t BSP_SD_Init(void);
63 | uint8_t BSP_SD_ITConfig(void);
64 | void BSP_SD_DetectIT(void);
65 | void BSP_SD_DetectCallback(void);
66 | uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
67 | uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
68 | uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
69 | uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
70 | uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
71 | void BSP_SD_IRQHandler(void);
72 | void BSP_SD_DMA_Tx_IRQHandler(void);
73 | void BSP_SD_DMA_Rx_IRQHandler(void);
74 | uint8_t BSP_SD_GetCardState(void);
75 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
76 | uint8_t BSP_SD_IsDetected(void);
77 |
78 | /* These functions can be modified in case the current settings (e.g. DMA stream)
79 | need to be changed for specific application needs */
80 | void BSP_SD_AbortCallback(void);
81 | void BSP_SD_WriteCpltCallback(void);
82 | void BSP_SD_ReadCpltCallback(void);
83 | /* USER CODE END BSP_H_CODE */
84 | #endif
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* __STM32F4_SD_H */
91 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/FATFS/Target/sd_diskio.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file sd_diskio.h
5 | * @brief Header for sd_diskio.c module
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 |
20 | /* Note: code generation based on sd_diskio_dma_rtos_template.h */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __SD_DISKIO_H
24 | #define __SD_DISKIO_H
25 |
26 | /* USER CODE BEGIN firstSection */
27 | /* can be used to modify / undefine following code or add new definitions */
28 | /* USER CODE END firstSection */
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "bsp_driver_sd.h"
32 | /* Exported types ------------------------------------------------------------*/
33 | /* Exported constants --------------------------------------------------------*/
34 | /* Exported functions ------------------------------------------------------- */
35 | extern const Diskio_drvTypeDef SD_Driver;
36 |
37 | /* USER CODE BEGIN lastSection */
38 | /* can be used to modify / undefine previous code or add new definitions */
39 | /* USER CODE END lastSection */
40 |
41 | #endif /* __SD_DISKIO_H */
42 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FatFs/src/diskio.c:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------*/
2 | /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2017 */
3 | /* */
4 | /* Portions COPYRIGHT 2017 STMicroelectronics */
5 | /* Portions Copyright (C) 2017, ChaN, all right reserved */
6 | /*-----------------------------------------------------------------------*/
7 | /* If a working storage control module is available, it should be */
8 | /* attached to the FatFs via a glue function rather than modifying it. */
9 | /* This is an example of glue functions to attach various existing */
10 | /* storage control modules to the FatFs module with a defined API. */
11 | /*-----------------------------------------------------------------------*/
12 |
13 | /* Includes ------------------------------------------------------------------*/
14 | #include "diskio.h"
15 | #include "ff_gen_drv.h"
16 |
17 | #if defined ( __GNUC__ )
18 | #ifndef __weak
19 | #define __weak __attribute__((weak))
20 | #endif
21 | #endif
22 |
23 | /* Private typedef -----------------------------------------------------------*/
24 | /* Private define ------------------------------------------------------------*/
25 | /* Private variables ---------------------------------------------------------*/
26 | extern Disk_drvTypeDef disk;
27 |
28 | /* Private function prototypes -----------------------------------------------*/
29 | /* Private functions ---------------------------------------------------------*/
30 |
31 | /**
32 | * @brief Gets Disk Status
33 | * @param pdrv: Physical drive number (0..)
34 | * @retval DSTATUS: Operation status
35 | */
36 | DSTATUS disk_status (
37 | BYTE pdrv /* Physical drive number to identify the drive */
38 | )
39 | {
40 | DSTATUS stat;
41 |
42 | stat = disk.drv[pdrv]->disk_status(disk.lun[pdrv]);
43 | return stat;
44 | }
45 |
46 | /**
47 | * @brief Initializes a Drive
48 | * @param pdrv: Physical drive number (0..)
49 | * @retval DSTATUS: Operation status
50 | */
51 | DSTATUS disk_initialize (
52 | BYTE pdrv /* Physical drive nmuber to identify the drive */
53 | )
54 | {
55 | DSTATUS stat = RES_OK;
56 |
57 | if(disk.is_initialized[pdrv] == 0)
58 | {
59 | disk.is_initialized[pdrv] = 1;
60 | stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);
61 | }
62 | return stat;
63 | }
64 |
65 | /**
66 | * @brief Reads Sector(s)
67 | * @param pdrv: Physical drive number (0..)
68 | * @param *buff: Data buffer to store read data
69 | * @param sector: Sector address (LBA)
70 | * @param count: Number of sectors to read (1..128)
71 | * @retval DRESULT: Operation result
72 | */
73 | DRESULT disk_read (
74 | BYTE pdrv, /* Physical drive nmuber to identify the drive */
75 | BYTE *buff, /* Data buffer to store read data */
76 | DWORD sector, /* Sector address in LBA */
77 | UINT count /* Number of sectors to read */
78 | )
79 | {
80 | DRESULT res;
81 |
82 | res = disk.drv[pdrv]->disk_read(disk.lun[pdrv], buff, sector, count);
83 | return res;
84 | }
85 |
86 | /**
87 | * @brief Writes Sector(s)
88 | * @param pdrv: Physical drive number (0..)
89 | * @param *buff: Data to be written
90 | * @param sector: Sector address (LBA)
91 | * @param count: Number of sectors to write (1..128)
92 | * @retval DRESULT: Operation result
93 | */
94 | #if _USE_WRITE == 1
95 | DRESULT disk_write (
96 | BYTE pdrv, /* Physical drive nmuber to identify the drive */
97 | const BYTE *buff, /* Data to be written */
98 | DWORD sector, /* Sector address in LBA */
99 | UINT count /* Number of sectors to write */
100 | )
101 | {
102 | DRESULT res;
103 |
104 | res = disk.drv[pdrv]->disk_write(disk.lun[pdrv], buff, sector, count);
105 | return res;
106 | }
107 | #endif /* _USE_WRITE == 1 */
108 |
109 | /**
110 | * @brief I/O control operation
111 | * @param pdrv: Physical drive number (0..)
112 | * @param cmd: Control code
113 | * @param *buff: Buffer to send/receive control data
114 | * @retval DRESULT: Operation result
115 | */
116 | #if _USE_IOCTL == 1
117 | DRESULT disk_ioctl (
118 | BYTE pdrv, /* Physical drive nmuber (0..) */
119 | BYTE cmd, /* Control code */
120 | void *buff /* Buffer to send/receive control data */
121 | )
122 | {
123 | DRESULT res;
124 |
125 | res = disk.drv[pdrv]->disk_ioctl(disk.lun[pdrv], cmd, buff);
126 | return res;
127 | }
128 | #endif /* _USE_IOCTL == 1 */
129 |
130 | /**
131 | * @brief Gets Time from RTC
132 | * @param None
133 | * @retval Time in DWORD
134 | */
135 | __weak DWORD get_fattime (void)
136 | {
137 | return 0;
138 | }
139 |
140 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
141 |
142 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FatFs/src/diskio.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------/
2 | / Low level disk interface modlue include file (C)ChaN, 2014 /
3 | /-----------------------------------------------------------------------*/
4 |
5 | #ifndef _DISKIO_DEFINED
6 | #define _DISKIO_DEFINED
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */
13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */
14 |
15 | #include "integer.h"
16 |
17 |
18 | /* Status of Disk Functions */
19 | typedef BYTE DSTATUS;
20 |
21 | /* Results of Disk Functions */
22 | typedef enum {
23 | RES_OK = 0, /* 0: Successful */
24 | RES_ERROR, /* 1: R/W Error */
25 | RES_WRPRT, /* 2: Write Protected */
26 | RES_NOTRDY, /* 3: Not Ready */
27 | RES_PARERR /* 4: Invalid Parameter */
28 | } DRESULT;
29 |
30 |
31 | /*---------------------------------------*/
32 | /* Prototypes for disk control functions */
33 |
34 |
35 | DSTATUS disk_initialize (BYTE pdrv);
36 | DSTATUS disk_status (BYTE pdrv);
37 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
38 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
39 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
40 | DWORD get_fattime (void);
41 |
42 | /* Disk Status Bits (DSTATUS) */
43 |
44 | #define STA_NOINIT 0x01 /* Drive not initialized */
45 | #define STA_NODISK 0x02 /* No medium in the drive */
46 | #define STA_PROTECT 0x04 /* Write protected */
47 |
48 |
49 | /* Command code for disk_ioctrl fucntion */
50 |
51 | /* Generic command (Used by FatFs) */
52 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
53 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
54 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
56 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
57 |
58 | /* Generic command (Not used by FatFs) */
59 | #define CTRL_POWER 5 /* Get/Set power status */
60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */
61 | #define CTRL_EJECT 7 /* Eject media */
62 | #define CTRL_FORMAT 8 /* Create physical format on the media */
63 |
64 | /* MMC/SDC specific ioctl command */
65 | #define MMC_GET_TYPE 10 /* Get card type */
66 | #define MMC_GET_CSD 11 /* Get CSD */
67 | #define MMC_GET_CID 12 /* Get CID */
68 | #define MMC_GET_OCR 13 /* Get OCR */
69 | #define MMC_GET_SDSTAT 14 /* Get SD status */
70 |
71 | /* ATA/CF specific ioctl command */
72 | #define ATA_GET_REV 20 /* Get F/W revision */
73 | #define ATA_GET_MODEL 21 /* Get model name */
74 | #define ATA_GET_SN 22 /* Get serial number */
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FatFs/src/ff_gen_drv.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file ff_gen_drv.c
4 | * @author MCD Application Team
5 | * @brief FatFs generic low level driver.
6 | *****************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | **/
18 | /* Includes ------------------------------------------------------------------*/
19 | #include "ff_gen_drv.h"
20 |
21 | /* Private typedef -----------------------------------------------------------*/
22 | /* Private define ------------------------------------------------------------*/
23 | /* Private variables ---------------------------------------------------------*/
24 | Disk_drvTypeDef disk = {{0},{0},{0},0};
25 |
26 | /* Private function prototypes -----------------------------------------------*/
27 | /* Private functions ---------------------------------------------------------*/
28 |
29 | /**
30 | * @brief Links a compatible diskio driver/lun id and increments the number of active
31 | * linked drivers.
32 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits.
33 | * @param drv: pointer to the disk IO Driver structure
34 | * @param path: pointer to the logical drive path
35 | * @param lun : only used for USB Key Disk to add multi-lun management
36 | else the parameter must be equal to 0
37 | * @retval Returns 0 in case of success, otherwise 1.
38 | */
39 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
40 | {
41 | uint8_t ret = 1;
42 | uint8_t DiskNum = 0;
43 |
44 | if(disk.nbr < _VOLUMES)
45 | {
46 | disk.is_initialized[disk.nbr] = 0;
47 | disk.drv[disk.nbr] = drv;
48 | disk.lun[disk.nbr] = lun;
49 | DiskNum = disk.nbr++;
50 | path[0] = DiskNum + '0';
51 | path[1] = ':';
52 | path[2] = '/';
53 | path[3] = 0;
54 | ret = 0;
55 | }
56 |
57 | return ret;
58 | }
59 |
60 | /**
61 | * @brief Links a compatible diskio driver and increments the number of active
62 | * linked drivers.
63 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits
64 | * @param drv: pointer to the disk IO Driver structure
65 | * @param path: pointer to the logical drive path
66 | * @retval Returns 0 in case of success, otherwise 1.
67 | */
68 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
69 | {
70 | return FATFS_LinkDriverEx(drv, path, 0);
71 | }
72 |
73 | /**
74 | * @brief Unlinks a diskio driver and decrements the number of active linked
75 | * drivers.
76 | * @param path: pointer to the logical drive path
77 | * @param lun : not used
78 | * @retval Returns 0 in case of success, otherwise 1.
79 | */
80 | uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun)
81 | {
82 | uint8_t DiskNum = 0;
83 | uint8_t ret = 1;
84 |
85 | if(disk.nbr >= 1)
86 | {
87 | DiskNum = path[0] - '0';
88 | if(disk.drv[DiskNum] != 0)
89 | {
90 | disk.drv[DiskNum] = 0;
91 | disk.lun[DiskNum] = 0;
92 | disk.nbr--;
93 | ret = 0;
94 | }
95 | }
96 |
97 | return ret;
98 | }
99 |
100 | /**
101 | * @brief Unlinks a diskio driver and decrements the number of active linked
102 | * drivers.
103 | * @param path: pointer to the logical drive path
104 | * @retval Returns 0 in case of success, otherwise 1.
105 | */
106 | uint8_t FATFS_UnLinkDriver(char *path)
107 | {
108 | return FATFS_UnLinkDriverEx(path, 0);
109 | }
110 |
111 | /**
112 | * @brief Gets number of linked drivers to the FatFs module.
113 | * @param None
114 | * @retval Number of attached drivers.
115 | */
116 | uint8_t FATFS_GetAttachedDriversNbr(void)
117 | {
118 | return disk.nbr;
119 | }
120 |
121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
122 |
123 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FatFs/src/ff_gen_drv.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file ff_gen_drv.h
4 | * @author MCD Application Team
5 | * @brief Header for ff_gen_drv.c module.
6 | *****************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | **/
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __FF_GEN_DRV_H
21 | #define __FF_GEN_DRV_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "diskio.h"
29 | #include "ff.h"
30 | #include "stdint.h"
31 |
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 |
35 | /**
36 | * @brief Disk IO Driver structure definition
37 | */
38 | typedef struct
39 | {
40 | DSTATUS (*disk_initialize) (BYTE); /*!< Initialize Disk Drive */
41 | DSTATUS (*disk_status) (BYTE); /*!< Get Disk Status */
42 | DRESULT (*disk_read) (BYTE, BYTE*, DWORD, UINT); /*!< Read Sector(s) */
43 | #if _USE_WRITE == 1
44 | DRESULT (*disk_write) (BYTE, const BYTE*, DWORD, UINT); /*!< Write Sector(s) when _USE_WRITE = 0 */
45 | #endif /* _USE_WRITE == 1 */
46 | #if _USE_IOCTL == 1
47 | DRESULT (*disk_ioctl) (BYTE, BYTE, void*); /*!< I/O control operation when _USE_IOCTL = 1 */
48 | #endif /* _USE_IOCTL == 1 */
49 |
50 | }Diskio_drvTypeDef;
51 |
52 | /**
53 | * @brief Global Disk IO Drivers structure definition
54 | */
55 | typedef struct
56 | {
57 | uint8_t is_initialized[_VOLUMES];
58 | const Diskio_drvTypeDef *drv[_VOLUMES];
59 | uint8_t lun[_VOLUMES];
60 | volatile uint8_t nbr;
61 |
62 | }Disk_drvTypeDef;
63 |
64 | /* Exported constants --------------------------------------------------------*/
65 | /* Exported macro ------------------------------------------------------------*/
66 | /* Exported functions ------------------------------------------------------- */
67 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path);
68 | uint8_t FATFS_UnLinkDriver(char *path);
69 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, BYTE lun);
70 | uint8_t FATFS_UnLinkDriverEx(char *path, BYTE lun);
71 | uint8_t FATFS_GetAttachedDriversNbr(void);
72 |
73 | #ifdef __cplusplus
74 | }
75 | #endif
76 |
77 | #endif /* __FF_GEN_DRV_H */
78 |
79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
80 |
81 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FatFs/src/integer.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------*/
2 | /* Integer type definitions for FatFs module */
3 | /*-------------------------------------------*/
4 |
5 | #ifndef _FF_INTEGER
6 | #define _FF_INTEGER
7 |
8 | #ifdef _WIN32 /* FatFs development platform */
9 |
10 | #include
11 | #include
12 | typedef unsigned __int64 QWORD;
13 |
14 |
15 | #else /* Embedded platform */
16 |
17 | /* These types MUST be 16-bit or 32-bit */
18 | typedef int INT;
19 | typedef unsigned int UINT;
20 |
21 | /* This type MUST be 8-bit */
22 | typedef unsigned char BYTE;
23 |
24 | /* These types MUST be 16-bit */
25 | typedef short SHORT;
26 | typedef unsigned short WORD;
27 | typedef unsigned short WCHAR;
28 |
29 | /* These types MUST be 32-bit */
30 | typedef long LONG;
31 | typedef unsigned long DWORD;
32 |
33 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
34 | typedef unsigned long long QWORD;
35 |
36 | #endif
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FatFs/src/option/syscall.c:
--------------------------------------------------------------------------------
1 | /*------------------------------------------------------------------------*/
2 | /* Sample code of OS dependent controls for FatFs */
3 | /* (C)ChaN, 2014 */
4 | /* Portions COPYRIGHT 2017 STMicroelectronics */
5 | /* Portions Copyright (C) 2014, ChaN, all right reserved */
6 | /*------------------------------------------------------------------------*/
7 |
8 | /**
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
13 | *
14 | * This software component is licensed by ST under BSD 3-Clause license,
15 | * the "License"; You may not use this file except in compliance with the
16 | * License. You may obtain a copy of the License at:
17 | * opensource.org/licenses/BSD-3-Clause
18 | *
19 | ******************************************************************************
20 | **/
21 |
22 |
23 |
24 | #include "../ff.h"
25 |
26 |
27 | #if _FS_REENTRANT
28 | /*------------------------------------------------------------------------*/
29 | /* Create a Synchronization Object */
30 | /*------------------------------------------------------------------------*/
31 | /* This function is called in f_mount() function to create a new
32 | / synchronization object, such as semaphore and mutex. When a 0 is returned,
33 | / the f_mount() function fails with FR_INT_ERR.
34 | */
35 |
36 | int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */
37 | BYTE vol, /* Corresponding volume (logical drive number) */
38 | _SYNC_t *sobj /* Pointer to return the created sync object */
39 | )
40 | {
41 |
42 | int ret;
43 | #if _USE_MUTEX
44 |
45 | #if (osCMSIS < 0x20000U)
46 | osMutexDef(MTX);
47 | *sobj = osMutexCreate(osMutex(MTX));
48 | #else
49 | *sobj = osMutexNew(NULL);
50 | #endif
51 |
52 | #else
53 |
54 | #if (osCMSIS < 0x20000U)
55 | osSemaphoreDef(SEM);
56 | *sobj = osSemaphoreCreate(osSemaphore(SEM), 1);
57 | #else
58 | *sobj = osSemaphoreNew(1, 1, NULL);
59 | #endif
60 |
61 | #endif
62 | ret = (*sobj != NULL);
63 |
64 | return ret;
65 | }
66 |
67 |
68 |
69 | /*------------------------------------------------------------------------*/
70 | /* Delete a Synchronization Object */
71 | /*------------------------------------------------------------------------*/
72 | /* This function is called in f_mount() function to delete a synchronization
73 | / object that created with ff_cre_syncobj() function. When a 0 is returned,
74 | / the f_mount() function fails with FR_INT_ERR.
75 | */
76 |
77 | int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */
78 | _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
79 | )
80 | {
81 | #if _USE_MUTEX
82 | osMutexDelete (sobj);
83 | #else
84 | osSemaphoreDelete (sobj);
85 | #endif
86 | return 1;
87 | }
88 |
89 |
90 |
91 | /*------------------------------------------------------------------------*/
92 | /* Request Grant to Access the Volume */
93 | /*------------------------------------------------------------------------*/
94 | /* This function is called on entering file functions to lock the volume.
95 | / When a 0 is returned, the file function fails with FR_TIMEOUT.
96 | */
97 |
98 | int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
99 | _SYNC_t sobj /* Sync object to wait */
100 | )
101 | {
102 | int ret = 0;
103 | #if (osCMSIS < 0x20000U)
104 |
105 | #if _USE_MUTEX
106 | if(osMutexWait(sobj, _FS_TIMEOUT) == osOK)
107 | #else
108 | if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK)
109 | #endif
110 |
111 | #else
112 |
113 | #if _USE_MUTEX
114 | if(osMutexAcquire(sobj, _FS_TIMEOUT) == osOK)
115 | #else
116 | if(osSemaphoreAcquire(sobj, _FS_TIMEOUT) == osOK)
117 | #endif
118 |
119 | #endif
120 | {
121 | ret = 1;
122 | }
123 |
124 | return ret;
125 | }
126 |
127 |
128 |
129 | /*------------------------------------------------------------------------*/
130 | /* Release Grant to Access the Volume */
131 | /*------------------------------------------------------------------------*/
132 | /* This function is called on leaving file functions to unlock the volume.
133 | */
134 |
135 | void ff_rel_grant (
136 | _SYNC_t sobj /* Sync object to be signaled */
137 | )
138 | {
139 | #if _USE_MUTEX
140 | osMutexRelease(sobj);
141 | #else
142 | osSemaphoreRelease(sobj);
143 | #endif
144 | }
145 |
146 | #endif
147 |
148 |
149 |
150 |
151 | #if _USE_LFN == 3 /* LFN with a working buffer on the heap */
152 | /*------------------------------------------------------------------------*/
153 | /* Allocate a memory block */
154 | /*------------------------------------------------------------------------*/
155 | /* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE.
156 | */
157 |
158 | void* ff_memalloc ( /* Returns pointer to the allocated memory block */
159 | UINT msize /* Number of bytes to allocate */
160 | )
161 | {
162 | return ff_malloc(msize); /* Allocate a new memory block with POSIX API */
163 | }
164 |
165 |
166 | /*------------------------------------------------------------------------*/
167 | /* Free a memory block */
168 | /*------------------------------------------------------------------------*/
169 |
170 | void ff_memfree (
171 | void* mblock /* Pointer to the memory block to free */
172 | )
173 | {
174 | ff_free(mblock); /* Discard the memory block with POSIX API */
175 | }
176 |
177 | #endif
178 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/freertos_mpool.h:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------------------
2 | * Copyright (c) 2013-2020 Arm Limited. All rights reserved.
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the License); you may
7 | * not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | *
18 | * Name: freertos_mpool.h
19 | * Purpose: CMSIS RTOS2 wrapper for FreeRTOS
20 | *
21 | *---------------------------------------------------------------------------*/
22 |
23 | #ifndef FREERTOS_MPOOL_H_
24 | #define FREERTOS_MPOOL_H_
25 |
26 | #include
27 | #include "FreeRTOS.h"
28 | #include "semphr.h"
29 |
30 | /* Memory Pool implementation definitions */
31 | #define MPOOL_STATUS 0x5EED0000U
32 |
33 | /* Memory Block header */
34 | typedef struct {
35 | void *next; /* Pointer to next block */
36 | } MemPoolBlock_t;
37 |
38 | /* Memory Pool control block */
39 | typedef struct MemPoolDef_t {
40 | MemPoolBlock_t *head; /* Pointer to head block */
41 | SemaphoreHandle_t sem; /* Pool semaphore handle */
42 | uint8_t *mem_arr; /* Pool memory array */
43 | uint32_t mem_sz; /* Pool memory array size */
44 | const char *name; /* Pointer to name string */
45 | uint32_t bl_sz; /* Size of a single block */
46 | uint32_t bl_cnt; /* Number of blocks */
47 | uint32_t n; /* Block allocation index */
48 | volatile uint32_t status; /* Object status flags */
49 | #if (configSUPPORT_STATIC_ALLOCATION == 1)
50 | StaticSemaphore_t mem_sem; /* Semaphore object memory */
51 | #endif
52 | } MemPool_t;
53 |
54 | /* No need to hide static object type, just align to coding style */
55 | #define StaticMemPool_t MemPool_t
56 |
57 | /* Define memory pool control block size */
58 | #define MEMPOOL_CB_SIZE (sizeof(StaticMemPool_t))
59 |
60 | /* Define size of the byte array required to create count of blocks of given size */
61 | #define MEMPOOL_ARR_SIZE(bl_count, bl_size) (((((bl_size) + (4 - 1)) / 4) * 4)*(bl_count))
62 |
63 | #endif /* FREERTOS_MPOOL_H_ */
64 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Middlewares/Third_Party/FreeRTOS/Source/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | Permission is hereby granted, free of charge, to any person obtaining a copy of
3 | this software and associated documentation files (the "Software"), to deal in
4 | the Software without restriction, including without limitation the rights to
5 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
6 | the Software, and to permit persons to whom the Software is furnished to do so,
7 | subject to the following conditions:
8 |
9 | The above copyright notice and this permission notice shall be included in all
10 | copies or substantial portions of the Software.
11 |
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
14 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 |
19 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/QuectelConfig.h:
--------------------------------------------------------------------------------
1 | #define __QUECTEL_USER_FRIENDLY_PROJECT_VERSION "A02_BETA_20240814"
2 |
3 |
4 | /**********************************************************
5 | Select quectel module
6 | **********************************************************/
7 | #define __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
8 | //#define __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__
9 |
10 |
11 | /**********************************************************
12 | Select support features
13 | **********************************************************/
14 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK__
15 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK_EXAMPLE__
16 |
17 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__
18 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_SERVER_EXAMPLE__
19 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_SERVER_EXAMPLE__
20 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_CLIENT_EXAMPLE__
21 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_CLIENT_EXAMPLE__
22 |
23 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__ /* Must enable __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM__*/
24 |
25 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_HTTP_S__
26 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_HTTP_S_EXAMPLE__
27 |
28 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FTP_S__
29 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FTP_S_EXAMPLE__
30 |
31 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S__
32 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S_EXAMPLE__
33 |
34 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__
35 |
36 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM__ /* Must enable __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__ */
37 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM_EXAMPLE__
38 |
39 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM__
40 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM_EXAMPLE__
41 |
42 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_DEBUG_PRINT__
43 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_DEBUG_SHELL__
44 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_DEBUG_SAVE__ /* Must enable __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_DEBUG_PRINT__ and __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__*/
45 |
46 | #define __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_EXAMPLE_MAIN__
47 |
48 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_filesystem.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM__
4 |
5 | /*
6 | * Copyright (c) 2006-2018, RT-Thread Development Team
7 | *
8 | * SPDX-License-Identifier: Apache-2.0
9 | *
10 | * Change Logs:
11 | * Date Author Notes
12 | * 2018-10-12 armink first version
13 | */
14 |
15 | /*
16 | * NOTE: DO NOT include this file on the header file.
17 | */
18 | #ifndef __BG95_FILESYSTEM_H__
19 | #define __BG95_FILESYSTEM_H__
20 | #include "ff.h"
21 | #include "at_osal.h"
22 | typedef struct {
23 | char filename[256];
24 | rt_uint32_t filesize;
25 | } File_Moudle_Info;
26 |
27 | struct file_device
28 | {
29 | struct at_client *client; /* AT Client object for AT device */
30 | rt_event_t file_event;
31 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__
32 | FIL file; /* AT device socket event */
33 | #endif
34 | };
35 | int ql_module_list_get(const char *dirname, File_Moudle_Info *fileList, u8_t maxFiles, u8_t mode);
36 | int ql_file_put_ex(char *localfile, char *remotefile,u32_t up_size );
37 | int ql_file_del(const char *dirname);
38 | int QL_fs_free(char *localfile, rt_size_t *free_size, rt_size_t *total_size);
39 | int QL_fs_open(char *localfile,u8_t mode);
40 | int QL_fs_write(u8_t file_handle,u8_t wirte_size, char *wirte_buffer);
41 | int QL_fs_close(u8_t file_handle);
42 | int QL_fs_read(u8_t file_handle, u8_t read_size, char *out_data);
43 | #endif /* __BG95_FTP_H__ */
44 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM__ */
45 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__ */
46 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_ftp.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FTP_S__
4 | /*
5 | * Copyright (c) 2006-2018, RT-Thread Development Team
6 | *
7 | * SPDX-License-Identifier: Apache-2.0
8 | *
9 | * Change Logs:
10 | * Date Author Notes
11 | * 2018-10-12 armink first version
12 | */
13 |
14 | /*
15 | * NOTE: DO NOT include this file on the header file.
16 | */
17 | #ifndef __BG95_FTP_H__
18 | #define __BG95_FTP_H__
19 |
20 | #include "ff.h"
21 | #include "bg95_ssl.h"
22 | #include "at_osal.h"
23 | #include "bg95_filesystem.h"
24 | // #define BG95_EVENT_FTP_OPEN_OK (1L << 0)
25 | // #define BG95_EVENT_FTP_OPEN_FIAL (1L << 1)
26 | typedef size_t (*QL_FTP_CLIENT_WRITE_CB_EX)(void *ptr, size_t size, size_t nmemb, void *stream);
27 | typedef size_t (*QL_FTP_CLIENT_READ_CB_EX)(void *ptr, size_t size, size_t nmemb, void *stream);
28 | typedef struct {
29 | u8_t context_id;
30 | char username[10];
31 | char password[10];
32 | u8_t filetype;
33 | u8_t transmode;
34 | u8_t rsptimeout;
35 | char hostname[20]; // ?????200??
36 | int port; // ???,???21
37 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__
38 | ql_SSL_Config ssl_config; //
39 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__ */
40 | QL_FTP_CLIENT_WRITE_CB_EX write_cb; // FTP?????
41 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__
42 | FIL file;
43 | #endif
44 | QL_FTP_CLIENT_READ_CB_EX read_cb; // FTP?????
45 | } FTP_Config;
46 |
47 | typedef struct {
48 | char filename[256];
49 | rt_uint32_t filesize;
50 | char date[30]; // ?????????,? "Sep 15 2022"
51 | } FileInfo;
52 |
53 | struct ftp_device
54 | {
55 |
56 | struct at_client *client; /* AT Client object for AT device */
57 | /* IP address */
58 | rt_event_t ftp_urc_event;
59 | rt_uint32_t filesize;
60 | void *user_data;
61 |
62 | };
63 |
64 |
65 | void PrintFileList(FileInfo *fileList, int fileCount);
66 | int QL_ftp_cfg(FTP_Config *config);
67 | int bg95_ftp_service_create(void);
68 | int bg95_ftp_service_destroy(void);
69 | int bg95_ftp_service_test(int argc, char *argv[]);
70 | int QL_ftp_path_get(char *path_name, u8_t path_name_size);
71 | int QL_ftp_list_get(const char *dirname, const char *local_name,FileInfo *fileList, u8_t maxFiles);
72 | int QL_ftp_path_cfg(const char *path_name) ;
73 | int QL_ftp_get(const char *filename, const char *target, int offset) ;
74 | int ql_ftp_client_get_ex(char *remotefile, char *localfile, QL_FTP_CLIENT_WRITE_CB_EX write_cb) ;
75 | int ql_ftp_client_put_ex(char *localfile, char *remotefile, QL_FTP_CLIENT_READ_CB_EX read_cb);
76 |
77 | #endif /* __BG95_FTP_H__ */
78 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FTP_S__ */
79 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__ */
80 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_http.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_HTTP_S__
4 | #ifndef __BG95_HTTP_H__
5 | #define __BG95_HTTP_H__
6 | #include "at_osal.h"
7 | #include "bg95_ssl.h"
8 | /*
26 | #include
27 | #include "at_osal.h"
28 | #include "debug_service.h"
29 | #include "broadcast_service.h"
30 |
31 | // -------------------------------------------------------- MODULE CONFIGURATION
32 | #define BG95_EVENT_MQTT_OK (1L << (8 + 4))
33 | #define BG95_EVENT_MQTT_FIAL (1L << (8 + 5))
34 | #define BG95_EVENT_MQTT_DIS_OK (1L << (8 + 6))
35 | // --------------------------------------------------------------- PUBLIC MACROS
36 |
37 |
38 |
39 | // ---------------------------------------------------------------- PUBLIC TYPES
40 |
41 | typedef void (*bg95_mqtt_handler_callback_t)(int8_t*, int8_t*, uint16_t);
42 |
43 |
44 | // ------------------------------------------------- PUBLIC FUNCTIONS PROTOTYPES
45 |
46 | void bg95_mqtt_connect_cb(struct at_client *client ,const char *data, rt_size_t size);
47 | void bg95_mqtt_qmtopen_cb(struct at_client *client ,const char *data, rt_size_t size);
48 | void bg95_mqtt_qmtconn_cb(struct at_client *client ,const char *data, rt_size_t size);
49 | void bg95_mqtt_qmtsub_cb(struct at_client *client ,const char *data, rt_size_t size);
50 | void bg95_mqtt_qmtpub_cb(struct at_client *client ,const char *data, rt_size_t size);
51 | void bg95_mqtt_qmtdisc_cb(struct at_client *client ,const char *data, rt_size_t size);
52 | void bg95_mqtt_qmtstat_cb(struct at_client *client, const char *data, rt_size_t size);
53 | void bg95_mqtt_urc_cb(struct at_client *client ,const char *data, rt_size_t size);
54 | void bg95_mqtt_handler_cb_set(bg95_mqtt_handler_callback_t cb);
55 |
56 |
57 | #endif // _BG95_MQTT_HANDLER_H_
58 |
59 | // ----------------------------------------------------------------- END OF FILE
60 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S__ */
61 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__ */
62 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_net.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/source/STM32F401RET6/Quectel/at_device/bg95/bg95_net.h
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_psm.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM__
4 | /*
5 | * Copyright (c) 2024, FAE
6 | *
7 | * SPDX-License-Identifier: Apache-2.0
8 | *
9 | * Change Logs:
10 | * Date Author Notes
11 | * 2024-1-5 kartigesan first version
12 | */
13 |
14 | /*
15 | * NOTE: DO NOT include this file on the header file.
16 | */
17 | #include
18 | #ifndef __BG95_PSM_H__
19 | #define __BG95_PSM_H__
20 |
21 | typedef struct {
22 | bool Mode;
23 | int Requested_Periodic_RAU;
24 | int Requested_GPRS_Ready_timer;
25 | int Requested_Periodic_TAU;
26 | int Requested_Active_Time;
27 | } psm_setting;
28 |
29 | typedef struct {
30 | int threshold;
31 | int psm_version;
32 |
33 | } psm_threshold_setting;
34 |
35 | typedef struct {
36 | int PSM_opt_mask;
37 | int max_oos_full_scans;
38 | int PSM_duration_due_to_oos;
39 | int PSM_randomization_window;
40 | int max_oos_time;
41 | int early_wakeup_time;
42 | } psm_ext_cfg;
43 |
44 | // read fucntions
45 | int QL_psm_settings_read();
46 | int QL_psm_threshold_settings_read();
47 | int QL_psm_ext_cfg_read();
48 | int QL_psm_ext_timer_read();
49 | //write functions
50 | int QL_psm_settings_write(psm_setting*);
51 | int QL_psm_threshold_settings_write(psm_threshold_setting*);
52 | int QL_psm_ext_cfg_write(psm_ext_cfg*);
53 | int QL_psm_ext_timer_write(bool);
54 |
55 | void QL_psm_stat();
56 |
57 | void QL_PSM_example();
58 |
59 | #endif /* __BG95_PSM_H__ */
60 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM__ */
61 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_socket.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__
4 | /*
5 | * Copyright (c) 2006-2018, RT-Thread Development Team
6 | *
7 | * SPDX-License-Identifier: Apache-2.0
8 | *
9 | * Change Logs:
10 | * Date Author Notes
11 | * 2018-10-12 armink first version
12 | */
13 |
14 | /*
15 | * NOTE: DO NOT include this file on the header file.
16 | */
17 | #ifndef __BG95_SOCKET_H__
18 | #define __BG95_SOCKET_H__
19 |
20 |
21 | int bg95_socket_service_create(void);
22 | int bg95_socket_service_destroy(void);
23 | int bg95_socket_service_test(int argc, char *argv[]);
24 |
25 |
26 | #endif /* __BG95_SOCKET_H__ */
27 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__ */
28 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/bg95/bg95_ssl.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__
4 | /*
5 | * Copyright (c) 2006-2018, RT-Thread Development Team
6 | *
7 | * SPDX-License-Identifier: Apache-2.0
8 | *
9 | * Change Logs:
10 | * Date Author Notes
11 | * 2018-10-12 armink first version
12 | */
13 |
14 | /*
15 | * NOTE: DO NOT include this file on the header file.
16 | */
17 | #ifndef __BG95_SSL_H__
18 | #define __BG95_SSL_H__
19 |
20 | #include "at_osal.h"
21 | typedef enum {
22 | QL_SSLCFG_SSLVERSION,
23 | QL_SSLCFG_CIPHERSUITE,
24 | QL_SSLCFG_CACERT,
25 | QL_SSLCFG_CLIENTCERT,
26 | QL_SSLCFG_CLIENTKEY,
27 | QL_SSLCFG_SECLEVEL,
28 | QL_SSLCFG_SESSION,
29 | QL_SSLCFG_SNI,
30 | QL_SSLCFG_CHECKHOST,
31 | QL_SSLCFG_IGNORELOCALTIME,
32 | QL_SSLCFG_NEGOTIATETIME,
33 | QL_SSLCFG_RENEGOTIATION,
34 | QL_SSLCFG_DTLS,
35 | QL_SSLCFG_DTLSVERSION
36 |
37 | } ql_sslcfg_type;
38 |
39 | // Enum type for SSL Version
40 | typedef enum {
41 | SSL_VERSION_SSL3_0 = 0,
42 | SSL_VERSION_TLS1_0,
43 | SSL_VERSION_TLS1_1,
44 | SSL_VERSION_TLS1_2,
45 | SSL_VERSION_ALL
46 | } ql_ssl_version;
47 |
48 | // Enum type for SSL Cipher Suites
49 | typedef enum {
50 | CIPHER_SUITE_TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035,
51 | CIPHER_SUITE_TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F,
52 | CIPHER_SUITE_TLS_RSA_WITH_RC4_128_SHA = 0x0005,
53 | CIPHER_SUITE_TLS_RSA_WITH_RC4_128_MD5 = 0x0004,
54 | CIPHER_SUITE_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A,
55 | CIPHER_SUITE_TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003D,
56 | CIPHER_SUITE_TLS_ECDH_ECDSA_WITH_RC4_128_SHA = 0xC002,
57 | CIPHER_SUITE_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC003,
58 | CIPHER_SUITE_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = 0xC004,
59 | CIPHER_SUITE_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005,
60 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = 0xC007,
61 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC008,
62 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009,
63 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A,
64 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_RC4_128_SHA = 0xC011,
65 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = 0xC012,
66 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013,
67 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014,
68 | CIPHER_SUITE_TLS_ECDH_RSA_WITH_RC4_128_SHA = 0xC00C,
69 | CIPHER_SUITE_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = 0xC00D,
70 | CIPHER_SUITE_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = 0xC00E,
71 | CIPHER_SUITE_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = 0xC00F,
72 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC023,
73 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC024,
74 | CIPHER_SUITE_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC025,
75 | CIPHER_SUITE_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC026,
76 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xC027,
77 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xC028,
78 | CIPHER_SUITE_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = 0xC029,
79 | CIPHER_SUITE_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = 0xC02A,
80 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02B,
81 | CIPHER_SUITE_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xC02F,
82 | CIPHER_SUITE_TLS_PSK_WITH_AES_128_CCM_8 = 0xC0A8,
83 | CIPHER_SUITE_TLS_PSK_WITH_AES_128_CBC_SHA256 = 0x00AE,
84 | CIPHER_SUITE_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 = 0xC0AE,
85 | CIPHER_SUITE_SUPPORT_ALL = 0xFFFF
86 | } ql_cipher_suites;
87 |
88 | // Enum type for Authentication Mode
89 | typedef enum {
90 | SEC_LEVEL_NO_AUTHENTICATION = 0,
91 | SEC_LEVEL_SERVER_AUTHENTICATION,
92 | SEC_LEVEL_SERVER_AND_CLIENT_AUTHENTICATION
93 | } ql_sec_level;
94 |
95 | // Enum type for DTLS Version
96 | typedef enum {
97 | DTLS_VERSION_DTLS1_0 = 0,
98 | DTLS_VERSION_DTLS1_2,
99 | DTLS_VERSION_BOTH
100 | } ql_dtls_version;
101 | // 定义FTP配置结构�?
102 | typedef struct {
103 | u8_t sslenble;
104 | u8_t ssltype;
105 | u8_t sslctxid;
106 | ql_cipher_suites ciphersuite;
107 | ql_sec_level seclevel;
108 | ql_ssl_version sslversion;
109 | } ql_SSL_Config;
110 |
111 |
112 | int ql_sslcfg_set(ql_sslcfg_type type, u8_t ssl_ctx_id, ...);
113 |
114 | #endif /* __BG95_FTP_H__ */
115 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__ */
116 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_BG95__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/ec20/ec20_net.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK__
4 |
5 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK__ */
6 | #endif /*__QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__*/
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/ec20/ec20_net.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK__
4 |
5 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK__ */
6 | #endif /*__QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__*/
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/ec20/ec20_socket.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__
4 |
5 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__ */
6 | #endif /*__QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__*/
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/at_device/ec20/ec20_socket.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__
3 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__
4 |
5 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__ */
6 | #endif /*__QUECTEL_USER_FRIENDLY_PROJECT_MODULE_SUPPORT_EC20__*/
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/common/inc/broadcast_service.h:
--------------------------------------------------------------------------------
1 | #ifndef __BROADCAST_SERVICE_H__
2 | #define __BROADCAST_SERVICE_H__
3 |
4 | #ifdef __cplusplus
5 | #if __cplusplus
6 | extern "C"{
7 | #endif
8 | #endif /* __cplusplus */
9 |
10 | /*------------------------------------------include-------------------------------------------------------*/
11 | #include "at_osal.h"
12 | /*------------------------------------------Macro--------------------------------------------------------*/
13 | #define MAX_MSG_COUNT (16)
14 | #define MAX_BROADCAST_RECEIVE (32)
15 |
16 | #define MSG_WHAT_INVALID 0x0000
17 |
18 |
19 | typedef enum
20 | {
21 | MSG_WHAT_MAIN_STATE = 0x1000,
22 |
23 | MSG_WHAT_BG95_MODULE_INIT = 0x2000,
24 | MSG_WHAT_BG95_MODULE_FAILURE,
25 | MSG_WHAT_BG95_SIM_START,
26 | MSG_WHAT_BG95_SIM_READY_FAILURE,
27 | MSG_WHAT_BG95_NW_START,
28 | MSG_WHAT_BG95_NET_NET_REG_SUCCESS,
29 | MSG_WHAT_BG95_NET_NET_REG_FAILURE,
30 | MSG_WHAT_BG95_DATACALL_START,
31 | MSG_WHAT_BG95_NET_DATACALL_SUCCESS,
32 | MSG_WHAT_BG95_NET_DATACALL_FAILURE,
33 | MSG_WHAT_BG95_NET_KEEPALIVE,
34 |
35 | MSG_WHAT_BG95_SOCKET_INIT_SUCCESS = 0x3000,
36 | MSG_WHAT_BG95_SOCKET_CONNECT_SUCCESS,
37 | MSG_WHAT_BG95_SOCKET_CONNECT_FAILURE,
38 | MSG_WHAT_BG95_SOCKET_SEND_DATA_SUCCESS,
39 | MSG_WHAT_BG95_SOCKET_SEND_DATA_FAILURE,
40 | MSG_WHAT_BG95_SOCKET_RECV_DATA_SUCCESS,
41 | MSG_WHAT_BG95_SOCKET_RECV_DATA_FAILURE,
42 |
43 | MSG_WHAT_BG95_FTP_INIT_SUCCESS = 0x4000,
44 | MSG_WHAT_BG95_FTP_CONNENT_SUCCESS,
45 | MSG_WHAT_BG95_FTP_UP_SUCCESS,
46 | MSG_WHAT_BG95_FTP_UP_FAIL,
47 | MSG_WHAT_BG95_FTP_GET_SUCCESS,
48 | MSG_WHAT_BG95_FTP_GET_FAIL,
49 | MSG_WHAT_BG95_FTP_CLOSE_SUCCESS,
50 |
51 | MSG_WHAT_BG95_HTTP_INIT_SUCCESS = 0x5000,
52 | MSG_WHAT_BG95_HTTP_REQUEST,
53 | MSG_WHAT_BG95_HTTP_REQUEST_SUCCESS,
54 | MSG_WHAT_BG95_HTTP_REQUEST_FAILURE,
55 | } MSG_WHAT_STATE;
56 |
57 | /*------------------------------------------typedef-----------------------------------------------------*/
58 | typedef struct
59 | {
60 | s32_t what;
61 | s32_t arg1;
62 | s32_t arg2;
63 | s32_t arg3;
64 | } msg_node, *msg_node_t;
65 |
66 | typedef struct
67 | {
68 | s32_t what;
69 | osMsgQueId_t msgqid; /* Msg queue id */
70 | } bcast_reveice, *bcast_reveice_t;
71 |
72 | /*------------------------------------------Func------------------------------------ --------------------*/
73 | /*******************************************************
74 | function api
75 | *******************************************************/
76 | s32_t bcast_service_create(void);
77 | s32_t bcast_service_destroy(void);
78 |
79 | s32_t bcast_reg_receive_msg(s32_t what, osMsgQueId_t msgqid);
80 | s32_t bcast_unreg_receive_msg (s32_t what, osMsgQueId_t msgqid);
81 |
82 | s32_t bcast_send_msg(msg_node_t msg);
83 | s32_t bcast_send_bcast_msg(s32_t what, s32_t arg1, s32_t arg2, s32_t arg3);
84 | s32_t bcast_send_my_msg(osMsgQueId_t my_msg_id, s32_t what, s32_t arg1, s32_t arg2, s32_t arg3);
85 |
86 | int bcast_service_test(s32_t argc, char *argv[]);
87 | /*------------------------------------------end--------------------------------------------------------*/
88 | #ifdef __cplusplus
89 | #if __cplusplus
90 | }
91 | #endif
92 | #endif /* __cplusplus */
93 |
94 | #endif /* __BROADCAST_SERVICE_H__ */
95 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/common/inc/debug_service.h:
--------------------------------------------------------------------------------
1 | #ifndef __DEBUG_SERVICE_H__
2 | #define __DEBUG_SERVICE_H__
3 | #include "QuectelConfig.h"
4 |
5 | #define DBG_BUFF_LEN (1024)
6 | #define CMD_ARGC_NUM (25)
7 | #define NAME_MAX_LEN (16)
8 |
9 | #define USE_DEBUG_ASSERT
10 |
11 | #ifdef USE_DEBUG_ASSERT
12 | #define dbg_assert_param(expr) ((expr) ? (void)0U : dbg_assert_failed((uint8_t *)__FILE__, __LINE__))
13 | #else
14 | #define assert_param(expr) ((void)0U)
15 | #endif /* USE_DEBUG_ASSERT */
16 |
17 | typedef enum
18 | {
19 | LOG_VERBOSE,
20 | LOG_DEBUG,
21 | LOG_INFO,
22 | LOG_WARN,
23 | LOG_ERR,
24 | LOG_MAX
25 | } debug_level;
26 |
27 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_DEBUG_PRINT__
28 | #define __FILENAME__ (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1):__FILE__)
29 | #define LOG_V( ...) debug_print(LOG_VERBOSE, "VER", "\033[0;37m", "\033[0m\r\n", __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
30 | #define LOG_D( ...) debug_print(LOG_DEBUG, "DEBUG", "\033[0;37m", "\033[0m\r\n", __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
31 | #define LOG_I( ...) debug_print(LOG_INFO, "INFO", "\033[0;34m", "\033[0m\r\n", __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
32 | #define LOG_H( ...) debug_print(LOG_INFO, "INFO", "\033[0;34m", "\033[0m", __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
33 | #define LOG_W( ...) debug_print(LOG_WARN, "WARN", "\033[0;33m", "\033[0m\r\n", __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
34 | #define LOG_E( ...) debug_print(LOG_ERR, "ERR", "\033[0;31m", "\033[0m\r\n", __FILENAME__, __FUNCTION__, __LINE__, __VA_ARGS__)
35 | #else
36 | #define LOG_V( ...)
37 | #define LOG_D( ...)
38 | #define LOG_I( ...)
39 | #define LOG_H( ...)
40 | #define LOG_W( ...)
41 | #define LOG_E( ...)
42 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_DEBUG_PRINT__ */
43 |
44 | typedef struct
45 | {
46 | char module_name[NAME_MAX_LEN];
47 | int (*fp)(int argc, char *argv[]);
48 | }dbg_module, *dbg_module_t;
49 | extern debug_level g_debug_level;
50 |
51 | int debug_service_create(void);
52 | int debug_service_destroy(void);
53 | void serial_input_parse_thread_wake_up();
54 |
55 |
56 | #endif /* __DEBUG_SERVICE_H__ */
57 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/common/inc/ringbuffer.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __RINGBUFFER_h__
3 | #define __RINGBUFFER_h__
4 |
5 | #include
6 | #include
7 |
8 | struct ringbuffer
9 | {
10 | uint8_t* buffer;
11 | uint16_t buffer_size;
12 | volatile uint16_t head;
13 | volatile uint16_t tail;
14 | };
15 |
16 | int ringbuffer_init(struct ringbuffer* rb, uint8_t* buffer, uint16_t size );
17 | uint16_t ringbuffer_data_len(struct ringbuffer* rb );
18 | uint16_t ringbuffer_putstr(struct ringbuffer* rb, const uint8_t* data, uint16_t data_length);
19 | int ringbuffer_getstr(struct ringbuffer* rb, uint8_t* data, uint16_t data_length);
20 |
21 | // void rb_data_putchar(const uint8_t ch);
22 | // uint16_t get_uart_recv_sta(void);
23 | // void uart_recv_sta_clean(void);
24 | // void set_uart_recv_sta(void);
25 |
26 | #endif // __RINGBUFFER_h__
27 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/common/inc/sd_fatfs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * sd_fatfs.h
3 | *
4 | * Created on: Oct 18, 2023
5 | * Author: barry
6 | */
7 | #include "QuectelConfig.h"
8 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__
9 | #ifndef _SD_FATFS_H_
10 | #define _SD_FATFS_H_
11 |
12 | void SD_INIT(void);
13 |
14 | #endif /* COMMON_INC_SD_FATFS_H_ */
15 |
16 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_TFCARD__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/common/src/ringbuffer.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/source/STM32F401RET6/Quectel/common/src/ringbuffer.c
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/common/src/sd_fatfs.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/source/STM32F401RET6/Quectel/common/src/sd_fatfs.c
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/fs/example_fs.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM_EXAMPLE__
3 | #include "bg95_filesystem.h"
4 | #include "at_osal.h"
5 | #include "debug_service.h"
6 | #include "broadcast_service.h"
7 | #include "debug_service.h"
8 | #include "example_fs.h"
9 |
10 | // Function to print a list of files with their details
11 | void PrintfsList(File_Moudle_Info *fileList, int fileCount)
12 | {
13 | for (int i = 0; i < fileCount; i++)
14 | {
15 | // Print the filename, size in kilobytes, and date for each file.
16 | LOG_V("Filename: %s , B: %ld \n",
17 | fileList[i].filename,
18 | fileList[i].filesize);
19 | }
20 | }
21 | char data[30 + 1];
22 | int user_fs_test(void *argument)
23 | {
24 | fs_test_config *config = (fs_test_config *)argument;
25 | if (config->fs_type == 0)
26 | {
27 | File_Moudle_Info fileList[5];
28 | int fileCount = ql_module_list_get(config->name_pattern, fileList, sizeof(fileList) / sizeof(fileList[0]), 0);
29 | if (fileCount >= 0)
30 | {
31 | PrintfsList(fileList, fileCount);
32 | }
33 | }
34 | else if (config->fs_type == 1) // DEL
35 | {
36 | ql_file_del(config->name_pattern);
37 | }
38 | else if (config->fs_type == 2) // FREE
39 | {
40 | rt_size_t free_size, total_size;
41 | LOG_V("name_pattern %s.\n", config->name_pattern);
42 | if (QL_fs_free(config->name_pattern, &free_size, &total_size) == 0)
43 | {
44 | LOG_V("Free size: %d, Total size: %d\n", free_size, total_size);
45 | }
46 | else
47 | {
48 | LOG_V("Failed to get file system info.\n");
49 | }
50 | }
51 | else if (config->fs_type == 3) // open
52 | {
53 | u8_t file_handle;
54 | file_handle = QL_fs_open(config->name_pattern, config->open_mode);
55 | LOG_V("file_handle %d\n", file_handle);
56 | }
57 | else if (config->fs_type == 4) // open
58 | {
59 |
60 | QL_fs_write(config->file_handle, config->wirte_read_size, config->wirte_buffer);
61 | }
62 | else if (config->fs_type == 5) // open
63 | {
64 | QL_fs_close(config->file_handle);
65 | }
66 | else if (config->fs_type == 6) // open
67 | {
68 |
69 | u8_t read_len = QL_fs_read(config->file_handle, config->wirte_read_size, data);
70 | if (read_len > 0)
71 | {
72 | LOG_V("Read data (%d bytes): %s\n", read_len, data);
73 | }
74 | else
75 | {
76 | LOG_V("Failed to read data.\n");
77 | }
78 | }
79 | }
80 |
81 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/fs/example_fs.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM_EXAMPLE__
3 | #ifndef __EXAMPLE_FS_H__
4 | #define __EXAMPLE_FS_H__
5 |
6 | #include "bg95_filesystem.h"
7 | typedef struct {
8 | int fs_type;//0 :list
9 | char name_pattern[10];
10 | u8_t open_mode;
11 | u8_t file_handle;
12 | u8_t wirte_read_size; //
13 | char wirte_buffer[30];
14 | }fs_test_config;
15 | #endif /* __EXAMPLE_FTP_H__ */
16 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FILESYSTEM_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/ftp/example_ftp.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Quectel-user-friendly-develop/STM32/48c34afca10daade6928bf744bee4b87cb9d73c9/source/STM32F401RET6/Quectel/custom/ftp/example_ftp.c
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/ftp/example_ftp.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FTP_S_EXAMPLE__
3 | #ifndef __EXAMPLE_FTP_H__
4 | #define __EXAMPLE_FTP_H__
5 |
6 | #include "bg95_ftp.h"
7 | FTP_Config Ql_get_ftp_Config();
8 | typedef struct {
9 | u8_t context_id;
10 | char username[10];
11 | char password[10];
12 | u8_t filetype;
13 | u8_t transmode;
14 | u8_t rsptimeout;
15 | char request_url[32];
16 | int port;
17 | char directoryToSet[16];
18 | char local_name[64];
19 | char rem_name[64];
20 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__
21 | ql_SSL_Config ssl_config; //
22 | #endif
23 | int ftp_type;
24 | }ftp_test_config;
25 | int example_ftp_test(void *argument);
26 | int ftp_test_get_List(ftp_test_config *config);
27 | int ftp_test_uploader(ftp_test_config *config);
28 | int ftp_test_get(ftp_test_config *config);
29 | void ftp_test_close(void);
30 | int ftp_test_open(ftp_test_config *config);
31 | #endif /* __EXAMPLE_FTP_H__ */
32 |
33 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_FTP_S_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/http/example_http.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_HTTP_S_EXAMPLE__
3 | #ifndef __EXAMPLE_HTTP_H__
4 | #define __EXAMPLE_HTTP_H__
5 |
6 | #include "bg95_http.h"
7 | typedef struct {
8 | ST_Http_Param_t param;
9 | ST_Http_Request_t request;
10 | char sd_card_path[64];
11 | }http_test_config;
12 |
13 | int example_http_test(void *argument);
14 |
15 | #endif /* __EXAMPLE_HTTP_H__ */
16 |
17 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_HTTP_S_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/mqtt/example_mqtt.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S_EXAMPLE__
3 | #include "main.h"
4 | #include "cmsis_os.h"
5 | #include "bg95_socket.h"
6 | #include "bg95_net.h"
7 | #include "ec20_socket.h"
8 | #include "ec20_net.h"
9 | #include "at_osal.h"
10 | #include "at.h"
11 | #include "debug_service.h"
12 | #include "at_socket.h"
13 | #include "broadcast_service.h"
14 |
15 | #include "example_mqtt.h"
16 |
17 | void test_topic_cb(int8_t *topic, int8_t *string_data, uint16_t string_len)
18 | {
19 | LOG_D("[MQTT MSG]: Topic:%s, Data: %s, Data Len: %d\r\n", topic, string_data, string_len);
20 | }
21 |
22 |
23 |
24 | int mqtt_config_conn(uint8_t mode,void *cfg_struct)
25 | {
26 | BG95_MQTT_CONN_FD local_conn;
27 | mqtt_test_config *config = (mqtt_test_config *)cfg_struct;
28 | LOG_D("Entering MQTT Demo");
29 | if (bg95_mqtt_config(&local_conn,mode, &config->conf_local_hq) != BG95_MQTT_OK)
30 | {
31 | LOG_D("Error initializing config");
32 |
33 | }
34 |
35 | bg95_mqtt_set_urc_cb(test_topic_cb);
36 | LOG_D("Configuring MQTT");
37 |
38 | config->ssl_config.sslctxid=local_conn;
39 | if(config->ssl_config.sslenble)
40 | {
41 | bg95_mqtt_ssl_config(local_conn,&config->ssl_config);
42 | }
43 |
44 | if (bg95_mqtt_connect(local_conn) != BG95_MQTT_OK)
45 | {
46 | LOG_D("Problem with creating connection");
47 | return 0xff;
48 | }
49 | return local_conn;
50 | }
51 |
52 |
53 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S_EXAMPLE__ */
54 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/mqtt/example_mqtt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2018, RT-Thread Development Team
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Change Logs:
7 | * Date Author Notes
8 | * 2018-10-12 armink first version
9 | */
10 |
11 | /*
12 | * NOTE: DO NOT include this file on the header file.
13 | */
14 | #include "QuectelConfig.h"
15 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S_EXAMPLE__
16 | #ifndef __EXAMPLE_MQTT_H__
17 | #define __EXAMPLE_MQTT_H__
18 | #include "bg95_mqtt.h"
19 |
20 | typedef struct {
21 | u8_t mqtt_test_type;
22 | u8_t Server_type;
23 | BG95_MQTT_CONFIG_T conf_local_hq ;
24 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SSL__
25 | ql_SSL_Config ssl_config; //
26 | #endif
27 |
28 |
29 | }mqtt_test_config;
30 |
31 | int example_mqtt_test(void *argument);
32 | int mqtt_config_conn(uint8_t mode,void *cfg_struct);
33 |
34 | #endif /* __EXAMPLE_MQTT_H__ */
35 |
36 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_MQTT_S_EXAMPLE__ */
37 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/network/example_network.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK_EXAMPLE__
3 |
4 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/network/example_network.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK_EXAMPLE__
3 |
4 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_NETWORK_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/psm/example_psm.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM_EXAMPLE__
3 |
4 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/psm/example_psm.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM_EXAMPLE__
3 |
4 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_PSM_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/sockets/example_tcp.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_CLIENT_EXAMPLE__
3 | #include "debug_service.h"
4 | #include "at_socket.h"
5 |
6 | int example_tcp_client_test(short sin_port, char *sin_addr, int loop_count, int loop_interval)
7 | {
8 | int fd, ret;
9 | char buf[64];
10 | struct sockaddr_in ser_sockaddr;
11 |
12 | LOG_D("%s Start",__FUNCTION__);
13 |
14 | //1.creat socket(ipv4 tcp)
15 | fd = socket(AF_INET, SOCK_STREAM, 0);
16 | if(fd<0)
17 | {
18 | LOG_E("Socket creat err");
19 | return -1;
20 | }
21 |
22 | //2.connect server
23 | ser_sockaddr.sin_family = AF_INET; //IPV4
24 | ser_sockaddr.sin_port = htons(sin_port); //port
25 | ser_sockaddr.sin_addr.s_addr = inet_addr(sin_addr);//ip
26 | ret = connect(fd, (struct sockaddr *)&ser_sockaddr, sizeof(ser_sockaddr));
27 | if(ret == -1)
28 | {
29 | LOG_E("Server connection failure");
30 | closesocket(fd);
31 | return -1;
32 | }
33 | LOG_I("Server connection success");
34 |
35 | sprintf(buf, "%d", fd);
36 | for (int i=0; i 0)
40 | LOG_I("Tcp client send %s ok %d, %d", buf, ret, fd);
41 | else
42 | LOG_E("Tcp client send %s err %d, %d", buf, ret, fd);
43 |
44 | memset(buf,0,64);
45 | ret = recv(fd,buf,64,0);
46 | if (0 < ret)
47 | LOG_I("Tcp client recv %s ok", buf);
48 | else
49 | LOG_E("Tcp client recv %s err", buf);
50 |
51 | osDelay(loop_interval);
52 | }
53 | closesocket(fd);
54 |
55 | LOG_D("%s over",__FUNCTION__);
56 |
57 | return 0;
58 | }
59 |
60 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_CLIENT_EXAMPLE__ */
61 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/sockets/example_tcp.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_CLIENT_EXAMPLE__
3 | #ifndef __EXAMPLE_TCP_H__
4 | #define __EXAMPLE_TCP_H__
5 |
6 | int example_tcp_client_test(short sin_port, char *sin_addr, int loop_count, int loop_interval);
7 |
8 | #endif /* __EXAMPLE_TCP_H__ */
9 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_CLIENT_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/sockets/example_tcp_server.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_TCP_SERVER_EXAMPLE__
3 | #include "debug_service.h"
4 | #include "at_socket.h"
5 | #include "example_tcp_server.h"
6 |
7 | static void example_tcp_server_proc_incoming_client(void *argument)
8 | {
9 | int ret;
10 | socket_tcp_server_config *config = (socket_tcp_server_config *)argument;
11 | unsigned int cli_sock_fd = config->sock_fd;
12 | unsigned int loop_count = config->loop_count;
13 | unsigned int loop_interval = config->loop_interval;
14 | char buf[64];
15 |
16 | LOG_V("%s Start(%d)",__FUNCTION__, cli_sock_fd);
17 |
18 | for (int i=0; i 0)
31 | LOG_I("Tcp server send %s ok %d", buf, ret);
32 | else
33 | {
34 | LOG_E("Tcp server send %s err %d", buf, ret);
35 | break;
36 | }
37 | osDelay(loop_interval);
38 | }
39 | closesocket(cli_sock_fd);
40 |
41 | LOG_V("%s over",__FUNCTION__);
42 | os_thread_exit();
43 | }
44 |
45 | int example_tcp_server_test(short sin_port, char *sin_addr, int max_connect_num, int loop_count, int loop_interval)
46 | {
47 | int ser_sock_fd, i, ret, cli_sock_fd, addr_len = sizeof(struct sockaddr_in);
48 | struct sockaddr_in ser_sock_addr, cli_sock_addr;
49 | socket_tcp_server_config config;
50 |
51 | osThreadId_t thread_id =NULL;
52 | osThreadAttr_t thread_attr = {.stack_size = 256*12, .priority = osPriorityNormal};
53 |
54 | LOG_V("%s Start",__FUNCTION__);
55 |
56 | //1.creat socket(ipv4 tcp)
57 | ser_sock_fd = socket(AF_INET, SOCK_STREAM, 0);
58 | if(ser_sock_fd<0)
59 | {
60 | LOG_E("Socket creat err %d", ser_sock_fd);
61 | return -1;
62 | }
63 |
64 | //2.bind server socket
65 | ser_sock_addr.sin_family = AF_INET; //IPV4
66 | ser_sock_addr.sin_port = htons(sin_port); //port
67 | ser_sock_addr.sin_addr.s_addr = inet_addr(sin_addr); //ip
68 | ret = bind(ser_sock_fd, (struct sockaddr *)&ser_sock_addr, addr_len);
69 | if(ret == -1)
70 | {
71 | LOG_E("Server bind failure");
72 | return -1;
73 | }
74 | LOG_I("Server bind success");
75 |
76 | for (i=0; i 0)
32 | LOG_I("Udp client send %s ok, ret = %d, fd = %d (to:%s, %d)", buf, ret, fd, inet_ntoa(ser_sockaddr.sin_addr.s_addr), ntohs(ser_sockaddr.sin_port));
33 | else
34 | LOG_E("Udp client send %s err %d, %d", buf, ret, fd);
35 |
36 | memset(buf,0,64);
37 | ret = recvfrom(fd,buf,64,0,(struct sockaddr *)&ser_sockaddr,sizeof(ser_sockaddr));
38 | if (0 < ret)
39 | LOG_I("Udp client recv %s ok, ret = %d, fd = %d (from:%s, %d)", buf, ret, fd, inet_ntoa(ser_sockaddr.sin_addr.s_addr), ntohs(ser_sockaddr.sin_port));
40 | else
41 | LOG_E("Udp client recv %s err", buf);
42 |
43 | osDelay(loop_interval);
44 | }
45 | closesocket(fd);
46 |
47 | LOG_V("%s over",__FUNCTION__);
48 |
49 | return 0;
50 | }
51 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_CLIENT_EXAMPLE__ */
52 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/sockets/example_udp.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_CLIENT_EXAMPLE__
3 | #ifndef __EXAMPLE_UDP_H__
4 | #define __EXAMPLE_UDP_H__
5 |
6 | int example_udp_client_test(short sin_port, char *sin_addr, int loop_count, int loop_interval);
7 |
8 | #endif /* __EXAMPLE_UDP_H__ */
9 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_CLIENT_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/sockets/example_udp_server.c:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_SERVER_EXAMPLE__
3 | #include "debug_service.h"
4 | #include "at_socket.h"
5 | #include "example_tcp_server.h"
6 |
7 | int example_udp_server_test(short sin_port, char *sin_addr, int loop_count, int loop_interval)
8 | {
9 | int ser_sock_fd, ret, addr_len = sizeof(struct sockaddr_in);
10 | char buf[1024] = "hello";
11 | struct sockaddr_in ser_sock_addr, cli_sock_addr;
12 |
13 | LOG_V("%s Start",__FUNCTION__);
14 |
15 | //1.creat socket(ipv4 udp)
16 | ser_sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
17 | if(ser_sock_fd<0)
18 | {
19 | LOG_E("Socket creat err %d", ser_sock_fd);
20 | return -1;
21 | }
22 |
23 | //2.bind server socket
24 | ser_sock_addr.sin_family = AF_INET; //IPV4
25 | ser_sock_addr.sin_port = htons(sin_port); //port
26 | ser_sock_addr.sin_addr.s_addr = inet_addr(sin_addr); //ip
27 | ret = bind(ser_sock_fd, (struct sockaddr *)&ser_sock_addr, addr_len);
28 | if(ret == -1)
29 | {
30 | LOG_E("Server bind failure");
31 | return -1;
32 | }
33 | LOG_I("Server bind success");
34 |
35 | //3.recvfrom/sendto
36 | for (int i=0; i 0)
48 | LOG_I("Udp server send %s ok, ret = %d, fd = %d (to:%s, %d)", buf, ret, ser_sock_fd, inet_ntoa(cli_sock_addr.sin_addr.s_addr), cli_sock_addr.sin_port);
49 | else
50 | LOG_E("Udp server send %s err(to:%s, %d)", buf, inet_ntoa(cli_sock_addr.sin_addr.s_addr), cli_sock_addr.sin_port);
51 |
52 | osDelay(loop_interval);
53 | }
54 | closesocket(ser_sock_fd);
55 |
56 | LOG_D("%s over",__FUNCTION__);
57 |
58 | return 0;
59 | }
60 |
61 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_SERVER_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/sockets/example_udp_server.h:
--------------------------------------------------------------------------------
1 | #include "QuectelConfig.h"
2 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_SERVER_EXAMPLE__
3 | #ifndef __EXAMPLE_UDP_SERVER_H__
4 | #define __EXAMPLE_UDP_SERVER_H__
5 |
6 | int example_udp_server_test(short sin_port, char *sin_addr, int loop_count, int loop_interval);
7 |
8 | #endif /* __EXAMPLE_UDP_SERVER_H__ */
9 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET_UDP_SERVER_EXAMPLE__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/custom/user_main.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2018, RT-Thread Development Team
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Change Logs:
7 | * Date Author Notes
8 | * 2018-10-12 armink first version
9 | */
10 |
11 | /*
12 | * NOTE: DO NOT include this file on the header file.
13 | */
14 |
15 | #include "QuectelConfig.h"
16 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_EXAMPLE_MAIN__
17 | #ifndef __MAIN_H__
18 | #define __MAIN_H__
19 |
20 | typedef enum {
21 | SOCKET_TCP,
22 | SOCKET_UDP,
23 | SOCKET_TCP_SERVER,
24 | SOCKET_UDP_SERVER,
25 | } socket_test_type;
26 |
27 | typedef struct {
28 | socket_test_type type;
29 | unsigned int max_connect_num;
30 | unsigned short sin_port;
31 | unsigned int loop_count;
32 | unsigned int loop_interval; //In milliseconds
33 | char sin_addr[32];
34 | void *user_data;
35 | }socket_test_config;
36 |
37 |
38 | void user_main(void * argv);
39 | int user_main_test(int argc, char *argv[]);
40 |
41 |
42 |
43 | #endif /* __MAIN_H__ */
44 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_EXAMPLE_MAIN__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/third_party/AT plugins from rt-thread-v4.0.2:
--------------------------------------------------------------------------------
1 | https://www.rt-thread.org/download.html#download-rt-thread-nano
2 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/third_party/at_client/include/at_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2018, RT-Thread Development Team
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Change Logs:
7 | * Date Author Notes
8 | * 2018-10-12 armink first version
9 | */
10 |
11 | /*
12 | * NOTE: DO NOT include this file on the header file.
13 | */
14 |
15 | #ifndef LOG_TAG
16 | #define DBG_TAG "at"
17 | #else
18 | #define DBG_TAG LOG_TAG
19 | #endif /* LOG_TAG */
20 |
21 | #ifdef AT_DEBUG
22 | #define DBG_LVL DBG_LOG
23 | #else
24 | #define DBG_LVL DBG_INFO
25 | #endif /* AT_DEBUG */
26 |
27 | // #include
28 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/third_party/at_client/src/at_utils.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2018, RT-Thread Development Team
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | *
6 | * Change Logs:
7 | * Date Author Notes
8 | * 2018-04-14 chenyong first version
9 | */
10 |
11 | #include
12 | #include
13 | #include
14 | #include "debug_service.h"
15 | static char send_buf[AT_CMD_MAX_LEN];
16 | static rt_size_t last_cmd_len = 0;
17 |
18 | /**
19 | * dump hex format data to console device
20 | *
21 | * @param name name for hex object, it will show on log header
22 | * @param buf hex buffer
23 | * @param size buffer size
24 | */
25 | void at_print_raw_cmd(const char *name, const char *buf, rt_size_t size)
26 | {
27 | #define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
28 | #define WIDTH_SIZE 96
29 |
30 | rt_size_t i, j;
31 | int index = 0;
32 | char buffer[512] = {0};
33 |
34 | if (g_debug_level > LOG_VERBOSE)
35 | return;
36 |
37 | for (i = 0; i < size; i += WIDTH_SIZE)
38 | {
39 | index += sprintf(buffer, "[AT] %s: ", name);
40 | // //rt_kprintf("[D/AT] %s: %04X-%04X: ", name, i, i + WIDTH_SIZE);
41 | // for (j = 0; j < WIDTH_SIZE; j++)
42 | // {
43 | // if (i + j < size)
44 | // {
45 | // index = sprintf(buffer+index, "%02X ", buf[i + j]);
46 | // //rt_kprintf("%02X ", buf[i + j]);
47 | // }
48 | // else
49 | // {
50 | // //rt_kprintf(" ");
51 | // index = sprintf(buffer+index, " ");
52 | // }
53 | // if ((j + 1) % 8 == 0)
54 | // {
55 | // //rt_kprintf(" ");
56 | // index = sprintf(buffer+index, " ");
57 | // }
58 | // }
59 | // //rt_kprintf(" ");
60 | // index = sprintf(buffer+index, " ");
61 | for (j = 0; j < WIDTH_SIZE; j++)
62 | {
63 | if (i + j < size)
64 | {
65 | //rt_kprintf("%c", __is_print(buf[i + j]) ? buf[i + j] : '.');
66 | index += sprintf(buffer+index, "%c", __is_print(buf[i + j]) ? buf[i + j] : '.');
67 | }
68 | }
69 | //rt_kprintf("\r\n");
70 | // index += sprintf(buffer+index, "\r\n");
71 | LOG_V("%s", buffer);
72 | }
73 | }
74 |
75 | const char *at_get_last_cmd(rt_size_t *cmd_size)
76 | {
77 | *cmd_size = last_cmd_len;
78 | return send_buf;
79 | }
80 |
81 | rt_size_t at_vprintf(rt_device_t device, const char *format, va_list args)
82 | {
83 | last_cmd_len = vsnprintf(send_buf, sizeof(send_buf), format, args);
84 | #ifdef AT_PRINT_RAW_CMD
85 | at_print_raw_cmd("sendline", send_buf, last_cmd_len);
86 | #endif
87 | return rt_device_write(device, 0, send_buf, last_cmd_len);
88 | }
89 |
90 | rt_size_t at_vprintfln(rt_device_t device, const char *format, va_list args)
91 | {
92 | rt_size_t len;
93 |
94 | len = at_vprintf(device, format, args);
95 |
96 | rt_device_write(device, 0, "\r\n", 2);
97 |
98 | return len + 2;
99 | }
100 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/third_party/at_socket/at_socket_device.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File : at_device.c
3 | * This file is part of RT-Thread RTOS
4 | * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program; if not, write to the Free Software Foundation, Inc.,
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 | *
20 | * Change Logs:
21 | * Date Author Notes
22 | * 2019-05-08 chenyong first version
23 | */
24 | #include "QuectelConfig.h"
25 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__
26 | #include
27 | #include
28 |
29 | #include
30 |
31 | #define DBG_TAG "at.dev"
32 | #define DBG_LVL DBG_INFO
33 |
34 | static struct at_device g_at_device = { 0 };
35 | static struct at_device_data g_at_device_data = { 0 };
36 |
37 | struct at_device *at_device_get(void)
38 | {
39 | return &g_at_device;
40 | }
41 |
42 | int at_device_socket_register(uint32_t socket_num, struct at_socket_ops *socket_ops, struct at_client *client, ip_addr_t *ip_addr)
43 | {
44 | osEventFlagsAttr_t event_attr;
45 |
46 | g_at_device.socket_num = socket_num;
47 | g_at_device.socket_ops = socket_ops;
48 | g_at_device.client = client;
49 | g_at_device.user_data = (void *)&g_at_device_data;
50 | memcpy(&g_at_device.ip_addr, ip_addr, sizeof(ip_addr_t));
51 |
52 | g_at_device.sockets = (struct at_socket *) rt_calloc(socket_num, sizeof(struct at_socket));
53 | if (g_at_device.sockets == RT_NULL)
54 | {
55 | LOG_E("no memory for AT Socket number(%d) create.", socket_num);
56 | return -RT_ENOMEM;
57 | }
58 |
59 | event_attr.name = "at_device";
60 | g_at_device.socket_event = OsalEventNCreate(&event_attr);
61 | if (g_at_device.socket_event == RT_NULL)
62 | {
63 | LOG_E("no memory for AT device socket event create.");
64 | rt_free(g_at_device.sockets);
65 | return -RT_ENOMEM;
66 | }
67 |
68 | return RT_EOK;
69 | }
70 |
71 | int at_device_socket_unregister(void)
72 | {
73 | if (g_at_device.sockets)
74 | rt_free(g_at_device.sockets);
75 |
76 | if (g_at_device.socket_event)
77 | OsalEventDelete(g_at_device.socket_event);
78 |
79 | return RT_EOK;
80 | }
81 |
82 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/Quectel/third_party/at_socket/at_socket_device.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File : at_socket_device.h
3 | * This file is part of RT-Thread RTOS
4 | * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program; if not, write to the Free Software Foundation, Inc.,
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 | *
20 | * Change Logs:
21 | * Date Author Notes
22 | * 2019-05-08 chenyong first version
23 | */
24 | #include "QuectelConfig.h"
25 | #ifdef __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__
26 | #ifndef __AT_SOCKET_DEVICE_H__
27 | #define __AT_SOCKET_DEVICE_H__
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | #include
34 | #include
35 |
36 | #define AT_DEVICE_SW_VERSION "2.0.4"
37 | #define AT_DEVICE_SW_VERSION_NUM 0x20004
38 |
39 | struct at_device_data
40 | {
41 |
42 | void *socket_data;
43 | void *user_data;
44 | };
45 |
46 | struct at_device
47 | {
48 | uint32_t socket_num; /* The maximum number of sockets need use */
49 | const struct at_socket_ops *socket_ops; /* AT device socket operations */
50 | struct at_client *client; /* AT Client object for AT device */
51 | ip_addr_t ip_addr; /* IP address */
52 | rt_event_t socket_event; /* AT device socket event */
53 | struct at_socket *sockets; /* AT device sockets list */
54 | /* user-specific data */
55 | void *user_data;
56 | };
57 | /* Get AT device object */
58 | struct at_device *at_device_get();
59 |
60 | int at_device_socket_register(uint32_t socket_num, struct at_socket_ops *socket_ops, struct at_client *client, ip_addr_t *ip_addr);
61 | int at_device_socket_unregister(void);
62 | #ifdef __cplusplus
63 | }
64 | #endif
65 |
66 | #endif /* __AT_SOCKET_DEVICE_H__ */
67 | #endif /* __QUECTEL_USER_FRIENDLY_PROJECT_FEATURE_SUPPORT_SOCKET__ */
--------------------------------------------------------------------------------
/source/STM32F401RET6/STM32F401RETX_FLASH.ld:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | **
4 | ** @file : LinkerScript.ld
5 | **
6 | ** @author : Auto-generated by STM32CubeIDE
7 | **
8 | ** @brief : Linker script for STM32F401RETx Device from STM32F4 series
9 | ** 512KBytes FLASH
10 | ** 96KBytes RAM
11 | **
12 | ** Set heap size, stack size and stack location according
13 | ** to application requirements.
14 | **
15 | ** Set memory bank area and size if external memory is used
16 | **
17 | ** Target : STMicroelectronics STM32
18 | **
19 | ** Distribution: The file is distributed as is, without any warranty
20 | ** of any kind.
21 | **
22 | ******************************************************************************
23 | ** @attention
24 | **
25 | ** Copyright (c) 2023 STMicroelectronics.
26 | ** All rights reserved.
27 | **
28 | ** This software is licensed under terms that can be found in the LICENSE file
29 | ** in the root directory of this software component.
30 | ** If no LICENSE file comes with this software, it is provided AS-IS.
31 | **
32 | ******************************************************************************
33 | */
34 |
35 | /* Entry Point */
36 | ENTRY(Reset_Handler)
37 |
38 | /* Highest address of the user mode stack */
39 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
40 |
41 | _Min_Heap_Size = 0x400; /* required amount of heap */
42 | _Min_Stack_Size = 0x800; /* required amount of stack */
43 |
44 | /* Memories definition */
45 | MEMORY
46 | {
47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
48 | FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 448K
49 | }
50 |
51 | /* Sections */
52 | SECTIONS
53 | {
54 | /* The startup code into "FLASH" Rom type memory */
55 | .isr_vector :
56 | {
57 | . = ALIGN(4);
58 | KEEP(*(.isr_vector)) /* Startup code */
59 | . = ALIGN(4);
60 | } >FLASH
61 |
62 | /* The program code and other data into "FLASH" Rom type memory */
63 | .text :
64 | {
65 | . = ALIGN(4);
66 | *(.text) /* .text sections (code) */
67 | *(.text*) /* .text* sections (code) */
68 | *(.glue_7) /* glue arm to thumb code */
69 | *(.glue_7t) /* glue thumb to arm code */
70 | *(.eh_frame)
71 |
72 | KEEP (*(.init))
73 | KEEP (*(.fini))
74 |
75 | . = ALIGN(4);
76 | _etext = .; /* define a global symbols at end of code */
77 | } >FLASH
78 |
79 | /* Constant data into "FLASH" Rom type memory */
80 | .rodata :
81 | {
82 | . = ALIGN(4);
83 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
84 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
85 | . = ALIGN(4);
86 | } >FLASH
87 |
88 | .ARM.extab : {
89 | . = ALIGN(4);
90 | *(.ARM.extab* .gnu.linkonce.armextab.*)
91 | . = ALIGN(4);
92 | } >FLASH
93 |
94 | .ARM : {
95 | . = ALIGN(4);
96 | __exidx_start = .;
97 | *(.ARM.exidx*)
98 | __exidx_end = .;
99 | . = ALIGN(4);
100 | } >FLASH
101 |
102 | .preinit_array :
103 | {
104 | . = ALIGN(4);
105 | PROVIDE_HIDDEN (__preinit_array_start = .);
106 | KEEP (*(.preinit_array*))
107 | PROVIDE_HIDDEN (__preinit_array_end = .);
108 | . = ALIGN(4);
109 | } >FLASH
110 |
111 | .init_array :
112 | {
113 | . = ALIGN(4);
114 | PROVIDE_HIDDEN (__init_array_start = .);
115 | KEEP (*(SORT(.init_array.*)))
116 | KEEP (*(.init_array*))
117 | PROVIDE_HIDDEN (__init_array_end = .);
118 | . = ALIGN(4);
119 | } >FLASH
120 |
121 | .fini_array :
122 | {
123 | . = ALIGN(4);
124 | PROVIDE_HIDDEN (__fini_array_start = .);
125 | KEEP (*(SORT(.fini_array.*)))
126 | KEEP (*(.fini_array*))
127 | PROVIDE_HIDDEN (__fini_array_end = .);
128 | . = ALIGN(4);
129 | } >FLASH
130 |
131 | /* Used by the startup to initialize data */
132 | _sidata = LOADADDR(.data);
133 |
134 | /* Initialized data sections into "RAM" Ram type memory */
135 | .data :
136 | {
137 | . = ALIGN(4);
138 | _sdata = .; /* create a global symbol at data start */
139 | *(.data) /* .data sections */
140 | *(.data*) /* .data* sections */
141 | *(.RamFunc) /* .RamFunc sections */
142 | *(.RamFunc*) /* .RamFunc* sections */
143 |
144 | . = ALIGN(4);
145 | _edata = .; /* define a global symbol at data end */
146 |
147 | } >RAM AT> FLASH
148 |
149 | /* Uninitialized data section into "RAM" Ram type memory */
150 | . = ALIGN(4);
151 | .bss :
152 | {
153 | /* This is used by the startup in order to initialize the .bss section */
154 | _sbss = .; /* define a global symbol at bss start */
155 | __bss_start__ = _sbss;
156 | *(.bss)
157 | *(.bss*)
158 | *(COMMON)
159 |
160 | . = ALIGN(4);
161 | _ebss = .; /* define a global symbol at bss end */
162 | __bss_end__ = _ebss;
163 | } >RAM
164 |
165 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
166 | ._user_heap_stack :
167 | {
168 | . = ALIGN(8);
169 | PROVIDE ( end = . );
170 | PROVIDE ( _end = . );
171 | . = . + _Min_Heap_Size;
172 | . = . + _Min_Stack_Size;
173 | . = ALIGN(8);
174 | } >RAM
175 |
176 | /* Remove information from the compiler libraries */
177 | /DISCARD/ :
178 | {
179 | libc.a ( * )
180 | libm.a ( * )
181 | libgcc.a ( * )
182 | }
183 |
184 | .ARM.attributes 0 : { *(.ARM.attributes) }
185 | }
186 |
--------------------------------------------------------------------------------
/source/STM32F401RET6/STM32F401RETX_RAM.ld:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | **
4 | ** @file : LinkerScript.ld (debug in RAM dedicated)
5 | **
6 | ** @author : Auto-generated by STM32CubeIDE
7 | **
8 | ** @brief : Linker script for STM32F401RETx Device from STM32F4 series
9 | ** 512KBytes FLASH
10 | ** 96KBytes RAM
11 | **
12 | ** Set heap size, stack size and stack location according
13 | ** to application requirements.
14 | **
15 | ** Set memory bank area and size if external memory is used
16 | **
17 | ** Target : STMicroelectronics STM32
18 | **
19 | ** Distribution: The file is distributed as is, without any warranty
20 | ** of any kind.
21 | **
22 | ******************************************************************************
23 | ** @attention
24 | **
25 | ** Copyright (c) 2023 STMicroelectronics.
26 | ** All rights reserved.
27 | **
28 | ** This software is licensed under terms that can be found in the LICENSE file
29 | ** in the root directory of this software component.
30 | ** If no LICENSE file comes with this software, it is provided AS-IS.
31 | **
32 | ******************************************************************************
33 | */
34 |
35 | /* Entry Point */
36 | ENTRY(Reset_Handler)
37 |
38 | /* Highest address of the user mode stack */
39 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
40 |
41 | _Min_Heap_Size = 0x400; /* required amount of heap */
42 | _Min_Stack_Size = 0x800; /* required amount of stack */
43 |
44 | /* Memories definition */
45 | MEMORY
46 | {
47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
48 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
49 | }
50 |
51 | /* Sections */
52 | SECTIONS
53 | {
54 | /* The startup code into "RAM" Ram type memory */
55 | .isr_vector :
56 | {
57 | . = ALIGN(4);
58 | KEEP(*(.isr_vector)) /* Startup code */
59 | . = ALIGN(4);
60 | } >RAM
61 |
62 | /* The program code and other data into "RAM" Ram type memory */
63 | .text :
64 | {
65 | . = ALIGN(4);
66 | *(.text) /* .text sections (code) */
67 | *(.text*) /* .text* sections (code) */
68 | *(.glue_7) /* glue arm to thumb code */
69 | *(.glue_7t) /* glue thumb to arm code */
70 | *(.eh_frame)
71 | *(.RamFunc) /* .RamFunc sections */
72 | *(.RamFunc*) /* .RamFunc* sections */
73 |
74 | KEEP (*(.init))
75 | KEEP (*(.fini))
76 |
77 | . = ALIGN(4);
78 | _etext = .; /* define a global symbols at end of code */
79 | } >RAM
80 |
81 | /* Constant data into "RAM" Ram type memory */
82 | .rodata :
83 | {
84 | . = ALIGN(4);
85 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
86 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
87 | . = ALIGN(4);
88 | } >RAM
89 |
90 | .ARM.extab : {
91 | . = ALIGN(4);
92 | *(.ARM.extab* .gnu.linkonce.armextab.*)
93 | . = ALIGN(4);
94 | } >RAM
95 |
96 | .ARM : {
97 | . = ALIGN(4);
98 | __exidx_start = .;
99 | *(.ARM.exidx*)
100 | __exidx_end = .;
101 | . = ALIGN(4);
102 | } >RAM
103 |
104 | .preinit_array :
105 | {
106 | . = ALIGN(4);
107 | PROVIDE_HIDDEN (__preinit_array_start = .);
108 | KEEP (*(.preinit_array*))
109 | PROVIDE_HIDDEN (__preinit_array_end = .);
110 | . = ALIGN(4);
111 | } >RAM
112 |
113 | .init_array :
114 | {
115 | . = ALIGN(4);
116 | PROVIDE_HIDDEN (__init_array_start = .);
117 | KEEP (*(SORT(.init_array.*)))
118 | KEEP (*(.init_array*))
119 | PROVIDE_HIDDEN (__init_array_end = .);
120 | . = ALIGN(4);
121 | } >RAM
122 |
123 | .fini_array :
124 | {
125 | . = ALIGN(4);
126 | PROVIDE_HIDDEN (__fini_array_start = .);
127 | KEEP (*(SORT(.fini_array.*)))
128 | KEEP (*(.fini_array*))
129 | PROVIDE_HIDDEN (__fini_array_end = .);
130 | . = ALIGN(4);
131 | } >RAM
132 |
133 | /* Used by the startup to initialize data */
134 | _sidata = LOADADDR(.data);
135 |
136 | /* Initialized data sections into "RAM" Ram type memory */
137 | .data :
138 | {
139 | . = ALIGN(4);
140 | _sdata = .; /* create a global symbol at data start */
141 | *(.data) /* .data sections */
142 | *(.data*) /* .data* sections */
143 |
144 | . = ALIGN(4);
145 | _edata = .; /* define a global symbol at data end */
146 |
147 | } >RAM
148 |
149 | /* Uninitialized data section into "RAM" Ram type memory */
150 | . = ALIGN(4);
151 | .bss :
152 | {
153 | /* This is used by the startup in order to initialize the .bss section */
154 | _sbss = .; /* define a global symbol at bss start */
155 | __bss_start__ = _sbss;
156 | *(.bss)
157 | *(.bss*)
158 | *(COMMON)
159 |
160 | . = ALIGN(4);
161 | _ebss = .; /* define a global symbol at bss end */
162 | __bss_end__ = _ebss;
163 | } >RAM
164 |
165 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
166 | ._user_heap_stack :
167 | {
168 | . = ALIGN(8);
169 | PROVIDE ( end = . );
170 | PROVIDE ( _end = . );
171 | . = . + _Min_Heap_Size;
172 | . = . + _Min_Stack_Size;
173 | . = ALIGN(8);
174 | } >RAM
175 |
176 | /* Remove information from the compiler libraries */
177 | /DISCARD/ :
178 | {
179 | libc.a ( * )
180 | libm.a ( * )
181 | libgcc.a ( * )
182 | }
183 |
184 | .ARM.attributes 0 : { *(.ARM.attributes) }
185 | }
186 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | /Debug/*
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | STM32F401RET6U_CubleIDE_IAP
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | com.st.stm32cube.ide.mcu.MCUProjectNature
23 | com.st.stm32cube.ide.mcu.MCUCubeProjectNature
24 | org.eclipse.cdt.core.cnature
25 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature
26 | com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature
27 | com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature
28 | com.st.stm32cube.ide.mcu.MCURootProjectNature
29 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
30 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
31 |
32 |
33 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/.settings/com.st.stm32cube.ide.mcu.sfrview.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | sfrviewstate={"fFavorites"\:{"fLists"\:{}},"fProperties"\:{"fNodeProperties"\:{}}}
3 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/.settings/org.eclipse.cdt.core.prefs:
--------------------------------------------------------------------------------
1 | doxygen/doxygen_new_line_after_brief=true
2 | doxygen/doxygen_use_brief_tag=false
3 | doxygen/doxygen_use_javadoc_tags=true
4 | doxygen/doxygen_use_pre_tag=false
5 | doxygen/doxygen_use_structural_commands=false
6 | eclipse.preferences.version=1
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/.settings/stm32cubeide.project.prefs:
--------------------------------------------------------------------------------
1 | 2F62501ED4689FB349E356AB974DBE57=459FE09A98503F2A53A852C5C30F8413
2 | 635E684B79701B039C64EA45C3F84D30=72E5764298A04209F5535C13F8964743
3 | 66BE74F758C12D739921AEA421D593D3=1
4 | 8DF89ED150041C4CBC7CB9A9CAA90856=459FE09A98503F2A53A852C5C30F8413
5 | DC22A860405A8BF2F2C095E5B6529F12=806CB6267E22517D443819C4448CBEDB
6 | eclipse.preferences.version=1
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Core/Inc/main.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : main.h
5 | * @brief : Header for main.c file.
6 | * This file contains the common defines of the application.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * Copyright (c) 2024 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software is licensed under terms that can be found in the LICENSE file
14 | * in the root directory of this software component.
15 | * If no LICENSE file comes with this software, it is provided AS-IS.
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __MAIN_H
23 | #define __MAIN_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Includes ------------------------------------------------------------------*/
30 | #include "stm32f4xx_hal.h"
31 |
32 | /* Private includes ----------------------------------------------------------*/
33 | /* USER CODE BEGIN Includes */
34 |
35 | /* USER CODE END Includes */
36 |
37 | /* Exported types ------------------------------------------------------------*/
38 | /* USER CODE BEGIN ET */
39 |
40 | /* USER CODE END ET */
41 |
42 | /* Exported constants --------------------------------------------------------*/
43 | /* USER CODE BEGIN EC */
44 |
45 | /* USER CODE END EC */
46 |
47 | /* Exported macro ------------------------------------------------------------*/
48 | /* USER CODE BEGIN EM */
49 |
50 | /* USER CODE END EM */
51 |
52 | /* Exported functions prototypes ---------------------------------------------*/
53 | void Error_Handler(void);
54 |
55 | /* USER CODE BEGIN EFP */
56 |
57 | /* USER CODE END EFP */
58 |
59 | /* Private defines -----------------------------------------------------------*/
60 | /* USER CODE BEGIN Private defines */
61 |
62 | /* USER CODE END Private defines */
63 |
64 | #ifdef __cplusplus
65 | }
66 | #endif
67 |
68 | #endif /* __MAIN_H */
69 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Core/Inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file stm32f4xx_it.h
5 | * @brief This file contains the headers of the interrupt handlers.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4xx_IT_H
22 | #define __STM32F4xx_IT_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Private includes ----------------------------------------------------------*/
29 | /* USER CODE BEGIN Includes */
30 |
31 | /* USER CODE END Includes */
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 | /* USER CODE BEGIN ET */
35 |
36 | /* USER CODE END ET */
37 |
38 | /* Exported constants --------------------------------------------------------*/
39 | /* USER CODE BEGIN EC */
40 |
41 | /* USER CODE END EC */
42 |
43 | /* Exported macro ------------------------------------------------------------*/
44 | /* USER CODE BEGIN EM */
45 |
46 | /* USER CODE END EM */
47 |
48 | /* Exported functions prototypes ---------------------------------------------*/
49 | void NMI_Handler(void);
50 | void HardFault_Handler(void);
51 | void MemManage_Handler(void);
52 | void BusFault_Handler(void);
53 | void UsageFault_Handler(void);
54 | void SVC_Handler(void);
55 | void DebugMon_Handler(void);
56 | void PendSV_Handler(void);
57 | void SysTick_Handler(void);
58 | void SDIO_IRQHandler(void);
59 | void DMA2_Stream3_IRQHandler(void);
60 | void DMA2_Stream6_IRQHandler(void);
61 | void USART6_IRQHandler(void);
62 | /* USER CODE BEGIN EFP */
63 |
64 | /* USER CODE END EFP */
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | #endif /* __STM32F4xx_IT_H */
71 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Core/Src/syscalls.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file syscalls.c
4 | * @author Auto-generated by STM32CubeIDE
5 | * @brief STM32CubeIDE Minimal System calls file
6 | *
7 | * For more information about which c-functions
8 | * need which of these lowlevel functions
9 | * please consult the Newlib libc-manual
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * Copyright (c) 2020-2023 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software is licensed under terms that can be found in the LICENSE file
17 | * in the root directory of this software component.
18 | * If no LICENSE file comes with this software, it is provided AS-IS.
19 | *
20 | ******************************************************************************
21 | */
22 |
23 | /* Includes */
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 |
34 | /* Variables */
35 | extern int __io_putchar(int ch) __attribute__((weak));
36 | extern int __io_getchar(void) __attribute__((weak));
37 |
38 |
39 | char *__env[1] = { 0 };
40 | char **environ = __env;
41 |
42 |
43 | /* Functions */
44 | void initialise_monitor_handles()
45 | {
46 | }
47 |
48 | int _getpid(void)
49 | {
50 | return 1;
51 | }
52 |
53 | int _kill(int pid, int sig)
54 | {
55 | (void)pid;
56 | (void)sig;
57 | errno = EINVAL;
58 | return -1;
59 | }
60 |
61 | void _exit (int status)
62 | {
63 | _kill(status, -1);
64 | while (1) {} /* Make sure we hang here */
65 | }
66 |
67 | __attribute__((weak)) int _read(int file, char *ptr, int len)
68 | {
69 | (void)file;
70 | int DataIdx;
71 |
72 | for (DataIdx = 0; DataIdx < len; DataIdx++)
73 | {
74 | *ptr++ = __io_getchar();
75 | }
76 |
77 | return len;
78 | }
79 |
80 | __attribute__((weak)) int _write(int file, char *ptr, int len)
81 | {
82 | (void)file;
83 | int DataIdx;
84 |
85 | for (DataIdx = 0; DataIdx < len; DataIdx++)
86 | {
87 | __io_putchar(*ptr++);
88 | }
89 | return len;
90 | }
91 |
92 | int _close(int file)
93 | {
94 | (void)file;
95 | return -1;
96 | }
97 |
98 |
99 | int _fstat(int file, struct stat *st)
100 | {
101 | (void)file;
102 | st->st_mode = S_IFCHR;
103 | return 0;
104 | }
105 |
106 | int _isatty(int file)
107 | {
108 | (void)file;
109 | return 1;
110 | }
111 |
112 | int _lseek(int file, int ptr, int dir)
113 | {
114 | (void)file;
115 | (void)ptr;
116 | (void)dir;
117 | return 0;
118 | }
119 |
120 | int _open(char *path, int flags, ...)
121 | {
122 | (void)path;
123 | (void)flags;
124 | /* Pretend like we always fail */
125 | return -1;
126 | }
127 |
128 | int _wait(int *status)
129 | {
130 | (void)status;
131 | errno = ECHILD;
132 | return -1;
133 | }
134 |
135 | int _unlink(char *name)
136 | {
137 | (void)name;
138 | errno = ENOENT;
139 | return -1;
140 | }
141 |
142 | int _times(struct tms *buf)
143 | {
144 | (void)buf;
145 | return -1;
146 | }
147 |
148 | int _stat(char *file, struct stat *st)
149 | {
150 | (void)file;
151 | st->st_mode = S_IFCHR;
152 | return 0;
153 | }
154 |
155 | int _link(char *old, char *new)
156 | {
157 | (void)old;
158 | (void)new;
159 | errno = EMLINK;
160 | return -1;
161 | }
162 |
163 | int _fork(void)
164 | {
165 | errno = EAGAIN;
166 | return -1;
167 | }
168 |
169 | int _execve(char *name, char **argv, char **env)
170 | {
171 | (void)name;
172 | (void)argv;
173 | (void)env;
174 | errno = ENOMEM;
175 | return -1;
176 | }
177 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Core/Src/sysmem.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file sysmem.c
4 | * @author Generated by STM32CubeIDE
5 | * @brief STM32CubeIDE System Memory calls file
6 | *
7 | * For more information about which C functions
8 | * need which of these lowlevel functions
9 | * please consult the newlib libc manual
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * Copyright (c) 2023 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software is licensed under terms that can be found in the LICENSE file
17 | * in the root directory of this software component.
18 | * If no LICENSE file comes with this software, it is provided AS-IS.
19 | *
20 | ******************************************************************************
21 | */
22 |
23 | /* Includes */
24 | #include
25 | #include
26 |
27 | /**
28 | * Pointer to the current high watermark of the heap usage
29 | */
30 | static uint8_t *__sbrk_heap_end = NULL;
31 |
32 | /**
33 | * @brief _sbrk() allocates memory to the newlib heap and is used by malloc
34 | * and others from the C library
35 | *
36 | * @verbatim
37 | * ############################################################################
38 | * # .data # .bss # newlib heap # MSP stack #
39 | * # # # # Reserved by _Min_Stack_Size #
40 | * ############################################################################
41 | * ^-- RAM start ^-- _end _estack, RAM end --^
42 | * @endverbatim
43 | *
44 | * This implementation starts allocating at the '_end' linker symbol
45 | * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack
46 | * The implementation considers '_estack' linker symbol to be RAM end
47 | * NOTE: If the MSP stack, at any point during execution, grows larger than the
48 | * reserved size, please increase the '_Min_Stack_Size'.
49 | *
50 | * @param incr Memory size
51 | * @return Pointer to allocated memory
52 | */
53 | void *_sbrk(ptrdiff_t incr)
54 | {
55 | extern uint8_t _end; /* Symbol defined in the linker script */
56 | extern uint8_t _estack; /* Symbol defined in the linker script */
57 | extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */
58 | const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
59 | const uint8_t *max_heap = (uint8_t *)stack_limit;
60 | uint8_t *prev_heap_end;
61 |
62 | /* Initialize heap end at first call */
63 | if (NULL == __sbrk_heap_end)
64 | {
65 | __sbrk_heap_end = &_end;
66 | }
67 |
68 | /* Protect heap from growing into the reserved MSP stack */
69 | if (__sbrk_heap_end + incr > max_heap)
70 | {
71 | errno = ENOMEM;
72 | return (void *)-1;
73 | }
74 |
75 | prev_heap_end = __sbrk_heap_end;
76 | __sbrk_heap_end += incr;
77 |
78 | return (void *)prev_heap_end;
79 | }
80 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.h
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /** @addtogroup CMSIS
20 | * @{
21 | */
22 |
23 | /** @addtogroup stm32f4xx_system
24 | * @{
25 | */
26 |
27 | /**
28 | * @brief Define to prevent recursive inclusion
29 | */
30 | #ifndef __SYSTEM_STM32F4XX_H
31 | #define __SYSTEM_STM32F4XX_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /** @addtogroup STM32F4xx_System_Includes
38 | * @{
39 | */
40 |
41 | /**
42 | * @}
43 | */
44 |
45 |
46 | /** @addtogroup STM32F4xx_System_Exported_types
47 | * @{
48 | */
49 | /* This variable is updated in three ways:
50 | 1) by calling CMSIS function SystemCoreClockUpdate()
51 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq()
52 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
53 | Note: If you use this function to configure the system clock; then there
54 | is no need to call the 2 first functions listed above, since SystemCoreClock
55 | variable is updated automatically.
56 | */
57 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
58 |
59 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
60 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /** @addtogroup STM32F4xx_System_Exported_Constants
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /** @addtogroup STM32F4xx_System_Exported_Macros
75 | * @{
76 | */
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | /** @addtogroup STM32F4xx_System_Exported_Functions
83 | * @{
84 | */
85 |
86 | extern void SystemInit(void);
87 | extern void SystemCoreClockUpdate(void);
88 | /**
89 | * @}
90 | */
91 |
92 | #ifdef __cplusplus
93 | }
94 | #endif
95 |
96 | #endif /*__SYSTEM_STM32F4XX_H */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /**
103 | * @}
104 | */
105 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/CMSIS/Device/ST/STM32F4xx/LICENSE.txt:
--------------------------------------------------------------------------------
1 | This software component is provided to you as part of a software package and
2 | applicable license terms are in the Package_license file. If you received this
3 | software component outside of a package or without applicable license terms,
4 | the terms of the Apache-2.0 license shall apply.
5 | You may obtain a copy of the Apache-2.0 at:
6 | https://opensource.org/licenses/Apache-2.0
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/CMSIS/Include/cmsis_version.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file cmsis_version.h
3 | * @brief CMSIS Core(M) Version definitions
4 | * @version V5.0.2
5 | * @date 19. April 2017
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef __CMSIS_VERSION_H
32 | #define __CMSIS_VERSION_H
33 |
34 | /* CMSIS Version definitions */
35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */
37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
39 | #endif
40 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/CMSIS/Include/tz_context.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file tz_context.h
3 | * @brief Context Management for Armv8-M TrustZone
4 | * @version V1.0.1
5 | * @date 10. January 2018
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef TZ_CONTEXT_H
32 | #define TZ_CONTEXT_H
33 |
34 | #include
35 |
36 | #ifndef TZ_MODULEID_T
37 | #define TZ_MODULEID_T
38 | /// \details Data type that identifies secure software modules called by a process.
39 | typedef uint32_t TZ_ModuleId_t;
40 | #endif
41 |
42 | /// \details TZ Memory ID identifies an allocated memory slot.
43 | typedef uint32_t TZ_MemoryId_t;
44 |
45 | /// Initialize secure context memory system
46 | /// \return execution status (1: success, 0: error)
47 | uint32_t TZ_InitContextSystem_S (void);
48 |
49 | /// Allocate context memory for calling secure software modules in TrustZone
50 | /// \param[in] module identifies software modules called from non-secure mode
51 | /// \return value != 0 id TrustZone memory slot identifier
52 | /// \return value 0 no memory available or internal error
53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
54 |
55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
56 | /// \param[in] id TrustZone memory slot identifier
57 | /// \return execution status (1: success, 0: error)
58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
59 |
60 | /// Load secure context (called on RTOS thread context switch)
61 | /// \param[in] id TrustZone memory slot identifier
62 | /// \return execution status (1: success, 0: error)
63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
64 |
65 | /// Store secure context (called on RTOS thread context switch)
66 | /// \param[in] id TrustZone memory slot identifier
67 | /// \return execution status (1: success, 0: error)
68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
69 |
70 | #endif // TZ_CONTEXT_H
71 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_dma_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of DMA HAL extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file in
13 | * the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __STM32F4xx_HAL_DMA_EX_H
21 | #define __STM32F4xx_HAL_DMA_EX_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32f4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32F4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup DMAEx
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /** @defgroup DMAEx_Exported_Types DMAEx Exported Types
40 | * @brief DMAEx Exported types
41 | * @{
42 | */
43 |
44 | /**
45 | * @brief HAL DMA Memory definition
46 | */
47 | typedef enum
48 | {
49 | MEMORY0 = 0x00U, /*!< Memory 0 */
50 | MEMORY1 = 0x01U /*!< Memory 1 */
51 | }HAL_DMA_MemoryTypeDef;
52 |
53 | /**
54 | * @}
55 | */
56 |
57 | /* Exported functions --------------------------------------------------------*/
58 | /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions
59 | * @brief DMAEx Exported functions
60 | * @{
61 | */
62 |
63 | /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions
64 | * @brief Extended features functions
65 | * @{
66 | */
67 |
68 | /* IO operation functions *******************************************************/
69 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
70 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
71 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory);
72 |
73 | /**
74 | * @}
75 | */
76 | /**
77 | * @}
78 | */
79 |
80 | /* Private functions ---------------------------------------------------------*/
81 | /** @defgroup DMAEx_Private_Functions DMAEx Private Functions
82 | * @brief DMAEx Private functions
83 | * @{
84 | */
85 | /**
86 | * @}
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /**
94 | * @}
95 | */
96 |
97 | #ifdef __cplusplus
98 | }
99 | #endif
100 |
101 | #endif /*__STM32F4xx_HAL_DMA_EX_H*/
102 |
103 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_flash_ramfunc.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH RAMFUNC driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file in
13 | * the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | ******************************************************************************
16 | */
17 |
18 | /* Define to prevent recursive inclusion -------------------------------------*/
19 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H
20 | #define __STM32F4xx_FLASH_RAMFUNC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
26 | defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32F4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup FLASH_RAMFUNC
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported macro ------------------------------------------------------------*/
41 | /* Exported functions --------------------------------------------------------*/
42 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
43 | * @{
44 | */
45 |
46 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
47 | * @{
48 | */
49 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void);
50 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void);
51 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void);
52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void);
53 | /**
54 | * @}
55 | */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 |
75 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */
76 |
77 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Drivers/STM32F4xx_HAL_Driver/LICENSE.txt:
--------------------------------------------------------------------------------
1 | This software component is provided to you as part of a software package and
2 | applicable license terms are in the Package_license file. If you received this
3 | software component outside of a package or without applicable license terms,
4 | the terms of the BSD-3-Clause license shall apply.
5 | You may obtain a copy of the BSD-3-Clause at:
6 | https://opensource.org/licenses/BSD-3-Clause
7 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/FATFS/App/fatfs.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file fatfs.c
5 | * @brief Code for fatfs applications
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 | #include "fatfs.h"
20 |
21 | uint8_t retSD; /* Return value for SD */
22 | char SDPath[4]; /* SD logical drive path */
23 | FATFS SDFatFS; /* File system object for SD logical drive */
24 | FIL SDFile; /* File object for SD */
25 |
26 | /* USER CODE BEGIN Variables */
27 |
28 | /* USER CODE END Variables */
29 |
30 | void MX_FATFS_Init(void)
31 | {
32 | /*## FatFS: Link the SD driver ###########################*/
33 | retSD = FATFS_LinkDriver(&SD_Driver, SDPath);
34 |
35 | /* USER CODE BEGIN Init */
36 | /* additional user code for init */
37 | /* USER CODE END Init */
38 | }
39 |
40 | /* USER CODE BEGIN Application */
41 |
42 | /* USER CODE END Application */
43 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/FATFS/App/fatfs.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file fatfs.h
5 | * @brief Header for fatfs applications
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __fatfs_H
21 | #define __fatfs_H
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include "ff.h"
27 | #include "ff_gen_drv.h"
28 | #include "sd_diskio.h" /* defines SD_Driver as external */
29 |
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | extern uint8_t retSD; /* Return value for SD */
35 | extern char SDPath[4]; /* SD logical drive path */
36 | extern FATFS SDFatFS; /* File system object for SD logical drive */
37 | extern FIL SDFile; /* File object for SD */
38 |
39 | void MX_FATFS_Init(void);
40 |
41 | /* USER CODE BEGIN Prototypes */
42 |
43 | /* USER CODE END Prototypes */
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 | #endif /*__fatfs_H */
48 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/FATFS/Target/bsp_driver_sd.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file bsp_driver_sd.h for F4 (based on stm324x9i_eval_sd.h)
5 | * @brief This file contains the common defines and functions prototypes for
6 | * the bsp_driver_sd.c driver.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * Copyright (c) 2024 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software is licensed under terms that can be found in the LICENSE file
14 | * in the root directory of this software component.
15 | * If no LICENSE file comes with this software, it is provided AS-IS.
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4_SD_H
22 | #define __STM32F4_SD_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal.h"
30 | #include "fatfs_platform.h"
31 |
32 | /* Exported types --------------------------------------------------------*/
33 | /**
34 | * @brief SD Card information structure
35 | */
36 | #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
37 |
38 | /* Exported constants --------------------------------------------------------*/
39 | /**
40 | * @brief SD status structure definition
41 | */
42 | #define MSD_OK ((uint8_t)0x00)
43 | #define MSD_ERROR ((uint8_t)0x01)
44 |
45 | /**
46 | * @brief SD transfer state definition
47 | */
48 | #define SD_TRANSFER_OK ((uint8_t)0x00)
49 | #define SD_TRANSFER_BUSY ((uint8_t)0x01)
50 |
51 | #define SD_PRESENT ((uint8_t)0x01)
52 | #define SD_NOT_PRESENT ((uint8_t)0x00)
53 | #define SD_DATATIMEOUT ((uint32_t)100000000)
54 |
55 | #ifdef OLD_API
56 | /* kept to avoid issue when migrating old projects. */
57 | /* USER CODE BEGIN 0 */
58 |
59 | /* USER CODE END 0 */
60 | #else
61 | /* USER CODE BEGIN BSP_H_CODE */
62 | /* Exported functions --------------------------------------------------------*/
63 | uint8_t BSP_SD_Init(void);
64 | uint8_t BSP_SD_ITConfig(void);
65 | void BSP_SD_DetectIT(void);
66 | void BSP_SD_DetectCallback(void);
67 | uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
68 | uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
69 | uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
70 | uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
71 | uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
72 | void BSP_SD_IRQHandler(void);
73 | void BSP_SD_DMA_Tx_IRQHandler(void);
74 | void BSP_SD_DMA_Rx_IRQHandler(void);
75 | uint8_t BSP_SD_GetCardState(void);
76 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
77 | uint8_t BSP_SD_IsDetected(void);
78 |
79 | /* These functions can be modified in case the current settings (e.g. DMA stream)
80 | need to be changed for specific application needs */
81 | void BSP_SD_AbortCallback(void);
82 | void BSP_SD_WriteCpltCallback(void);
83 | void BSP_SD_ReadCpltCallback(void);
84 | /* USER CODE END BSP_H_CODE */
85 | #endif
86 |
87 | #ifdef __cplusplus
88 | }
89 | #endif
90 |
91 | #endif /* __STM32F4_SD_H */
92 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/FATFS/Target/fatfs_platform.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : fatfs_platform.c
5 | * @brief : fatfs_platform source file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 | #include "fatfs_platform.h"
20 |
21 | uint8_t BSP_PlatformIsDetected(void) {
22 | uint8_t status = SD_PRESENT;
23 | /* Check SD card detect pin */
24 | if(HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) != GPIO_PIN_RESET)
25 | {
26 | status = SD_NOT_PRESENT;
27 | }
28 | /* USER CODE BEGIN 1 */
29 | /* user code can be inserted here */
30 | /* USER CODE END 1 */
31 | return status;
32 | }
33 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/FATFS/Target/fatfs_platform.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : fatfs_platform.h
5 | * @brief : fatfs_platform header file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 | /* Includes ------------------------------------------------------------------*/
20 | #include "stm32f4xx_hal.h"
21 | /* Defines ------------------------------------------------------------------*/
22 | #define SD_PRESENT ((uint8_t)0x01) /* also in bsp_driver_sd.h */
23 | #define SD_NOT_PRESENT ((uint8_t)0x00) /* also in bsp_driver_sd.h */
24 | #define SD_DETECT_PIN GPIO_PIN_11
25 | #define SD_DETECT_GPIO_PORT GPIOA
26 | /* Prototypes ---------------------------------------------------------------*/
27 | uint8_t BSP_PlatformIsDetected(void);
28 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/FATFS/Target/sd_diskio.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file sd_diskio.h
5 | * @brief Header for sd_diskio.c module
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2024 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software is licensed under terms that can be found in the LICENSE file
13 | * in the root directory of this software component.
14 | * If no LICENSE file comes with this software, it is provided AS-IS.
15 | *
16 | ******************************************************************************
17 | */
18 | /* USER CODE END Header */
19 |
20 | /* Note: code generation based on sd_diskio_dma_template.h */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __SD_DISKIO_H
24 | #define __SD_DISKIO_H
25 |
26 | /* USER CODE BEGIN firstSection */
27 | /* can be used to modify / undefine following code or add new definitions */
28 | /* USER CODE END firstSection */
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "bsp_driver_sd.h"
32 | /* Exported types ------------------------------------------------------------*/
33 | /* Exported constants --------------------------------------------------------*/
34 | /* Exported functions ------------------------------------------------------- */
35 | extern const Diskio_drvTypeDef SD_Driver;
36 |
37 | /* USER CODE BEGIN lastSection */
38 | /* can be used to modify / undefine previous code or add new definitions */
39 | /* USER CODE END lastSection */
40 |
41 | #endif /* __SD_DISKIO_H */
42 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Middlewares/Third_Party/FatFs/src/diskio.c:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------*/
2 | /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2017 */
3 | /* */
4 | /* Portions COPYRIGHT 2017 STMicroelectronics */
5 | /* Portions Copyright (C) 2017, ChaN, all right reserved */
6 | /*-----------------------------------------------------------------------*/
7 | /* If a working storage control module is available, it should be */
8 | /* attached to the FatFs via a glue function rather than modifying it. */
9 | /* This is an example of glue functions to attach various existing */
10 | /* storage control modules to the FatFs module with a defined API. */
11 | /*-----------------------------------------------------------------------*/
12 |
13 | /* Includes ------------------------------------------------------------------*/
14 | #include "diskio.h"
15 | #include "ff_gen_drv.h"
16 |
17 | #if defined ( __GNUC__ )
18 | #ifndef __weak
19 | #define __weak __attribute__((weak))
20 | #endif
21 | #endif
22 |
23 | /* Private typedef -----------------------------------------------------------*/
24 | /* Private define ------------------------------------------------------------*/
25 | /* Private variables ---------------------------------------------------------*/
26 | extern Disk_drvTypeDef disk;
27 |
28 | /* Private function prototypes -----------------------------------------------*/
29 | /* Private functions ---------------------------------------------------------*/
30 |
31 | /**
32 | * @brief Gets Disk Status
33 | * @param pdrv: Physical drive number (0..)
34 | * @retval DSTATUS: Operation status
35 | */
36 | DSTATUS disk_status (
37 | BYTE pdrv /* Physical drive number to identify the drive */
38 | )
39 | {
40 | DSTATUS stat;
41 |
42 | stat = disk.drv[pdrv]->disk_status(disk.lun[pdrv]);
43 | return stat;
44 | }
45 |
46 | /**
47 | * @brief Initializes a Drive
48 | * @param pdrv: Physical drive number (0..)
49 | * @retval DSTATUS: Operation status
50 | */
51 | DSTATUS disk_initialize (
52 | BYTE pdrv /* Physical drive nmuber to identify the drive */
53 | )
54 | {
55 | DSTATUS stat = RES_OK;
56 |
57 | if(disk.is_initialized[pdrv] == 0)
58 | {
59 | disk.is_initialized[pdrv] = 1;
60 | stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);
61 | }
62 | return stat;
63 | }
64 |
65 | /**
66 | * @brief Reads Sector(s)
67 | * @param pdrv: Physical drive number (0..)
68 | * @param *buff: Data buffer to store read data
69 | * @param sector: Sector address (LBA)
70 | * @param count: Number of sectors to read (1..128)
71 | * @retval DRESULT: Operation result
72 | */
73 | DRESULT disk_read (
74 | BYTE pdrv, /* Physical drive nmuber to identify the drive */
75 | BYTE *buff, /* Data buffer to store read data */
76 | DWORD sector, /* Sector address in LBA */
77 | UINT count /* Number of sectors to read */
78 | )
79 | {
80 | DRESULT res;
81 |
82 | res = disk.drv[pdrv]->disk_read(disk.lun[pdrv], buff, sector, count);
83 | return res;
84 | }
85 |
86 | /**
87 | * @brief Writes Sector(s)
88 | * @param pdrv: Physical drive number (0..)
89 | * @param *buff: Data to be written
90 | * @param sector: Sector address (LBA)
91 | * @param count: Number of sectors to write (1..128)
92 | * @retval DRESULT: Operation result
93 | */
94 | #if _USE_WRITE == 1
95 | DRESULT disk_write (
96 | BYTE pdrv, /* Physical drive nmuber to identify the drive */
97 | const BYTE *buff, /* Data to be written */
98 | DWORD sector, /* Sector address in LBA */
99 | UINT count /* Number of sectors to write */
100 | )
101 | {
102 | DRESULT res;
103 |
104 | res = disk.drv[pdrv]->disk_write(disk.lun[pdrv], buff, sector, count);
105 | return res;
106 | }
107 | #endif /* _USE_WRITE == 1 */
108 |
109 | /**
110 | * @brief I/O control operation
111 | * @param pdrv: Physical drive number (0..)
112 | * @param cmd: Control code
113 | * @param *buff: Buffer to send/receive control data
114 | * @retval DRESULT: Operation result
115 | */
116 | #if _USE_IOCTL == 1
117 | DRESULT disk_ioctl (
118 | BYTE pdrv, /* Physical drive nmuber (0..) */
119 | BYTE cmd, /* Control code */
120 | void *buff /* Buffer to send/receive control data */
121 | )
122 | {
123 | DRESULT res;
124 |
125 | res = disk.drv[pdrv]->disk_ioctl(disk.lun[pdrv], cmd, buff);
126 | return res;
127 | }
128 | #endif /* _USE_IOCTL == 1 */
129 |
130 | /**
131 | * @brief Gets Time from RTC
132 | * @param None
133 | * @retval Time in DWORD
134 | */
135 | __weak DWORD get_fattime (void)
136 | {
137 | return 0;
138 | }
139 |
140 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
141 |
142 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Middlewares/Third_Party/FatFs/src/diskio.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------/
2 | / Low level disk interface modlue include file (C)ChaN, 2014 /
3 | /-----------------------------------------------------------------------*/
4 |
5 | #ifndef _DISKIO_DEFINED
6 | #define _DISKIO_DEFINED
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */
13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */
14 |
15 | #include "integer.h"
16 |
17 |
18 | /* Status of Disk Functions */
19 | typedef BYTE DSTATUS;
20 |
21 | /* Results of Disk Functions */
22 | typedef enum {
23 | RES_OK = 0, /* 0: Successful */
24 | RES_ERROR, /* 1: R/W Error */
25 | RES_WRPRT, /* 2: Write Protected */
26 | RES_NOTRDY, /* 3: Not Ready */
27 | RES_PARERR /* 4: Invalid Parameter */
28 | } DRESULT;
29 |
30 |
31 | /*---------------------------------------*/
32 | /* Prototypes for disk control functions */
33 |
34 |
35 | DSTATUS disk_initialize (BYTE pdrv);
36 | DSTATUS disk_status (BYTE pdrv);
37 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
38 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
39 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
40 | DWORD get_fattime (void);
41 |
42 | /* Disk Status Bits (DSTATUS) */
43 |
44 | #define STA_NOINIT 0x01 /* Drive not initialized */
45 | #define STA_NODISK 0x02 /* No medium in the drive */
46 | #define STA_PROTECT 0x04 /* Write protected */
47 |
48 |
49 | /* Command code for disk_ioctrl fucntion */
50 |
51 | /* Generic command (Used by FatFs) */
52 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
53 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
54 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
56 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
57 |
58 | /* Generic command (Not used by FatFs) */
59 | #define CTRL_POWER 5 /* Get/Set power status */
60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */
61 | #define CTRL_EJECT 7 /* Eject media */
62 | #define CTRL_FORMAT 8 /* Create physical format on the media */
63 |
64 | /* MMC/SDC specific ioctl command */
65 | #define MMC_GET_TYPE 10 /* Get card type */
66 | #define MMC_GET_CSD 11 /* Get CSD */
67 | #define MMC_GET_CID 12 /* Get CID */
68 | #define MMC_GET_OCR 13 /* Get OCR */
69 | #define MMC_GET_SDSTAT 14 /* Get SD status */
70 |
71 | /* ATA/CF specific ioctl command */
72 | #define ATA_GET_REV 20 /* Get F/W revision */
73 | #define ATA_GET_MODEL 21 /* Get model name */
74 | #define ATA_GET_SN 22 /* Get serial number */
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Middlewares/Third_Party/FatFs/src/ff_gen_drv.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file ff_gen_drv.c
4 | * @author MCD Application Team
5 | * @brief FatFs generic low level driver.
6 | *****************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | **/
18 | /* Includes ------------------------------------------------------------------*/
19 | #include "ff_gen_drv.h"
20 |
21 | /* Private typedef -----------------------------------------------------------*/
22 | /* Private define ------------------------------------------------------------*/
23 | /* Private variables ---------------------------------------------------------*/
24 | Disk_drvTypeDef disk = {{0},{0},{0},0};
25 |
26 | /* Private function prototypes -----------------------------------------------*/
27 | /* Private functions ---------------------------------------------------------*/
28 |
29 | /**
30 | * @brief Links a compatible diskio driver/lun id and increments the number of active
31 | * linked drivers.
32 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits.
33 | * @param drv: pointer to the disk IO Driver structure
34 | * @param path: pointer to the logical drive path
35 | * @param lun : only used for USB Key Disk to add multi-lun management
36 | else the parameter must be equal to 0
37 | * @retval Returns 0 in case of success, otherwise 1.
38 | */
39 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
40 | {
41 | uint8_t ret = 1;
42 | uint8_t DiskNum = 0;
43 |
44 | if(disk.nbr < _VOLUMES)
45 | {
46 | disk.is_initialized[disk.nbr] = 0;
47 | disk.drv[disk.nbr] = drv;
48 | disk.lun[disk.nbr] = lun;
49 | DiskNum = disk.nbr++;
50 | path[0] = DiskNum + '0';
51 | path[1] = ':';
52 | path[2] = '/';
53 | path[3] = 0;
54 | ret = 0;
55 | }
56 |
57 | return ret;
58 | }
59 |
60 | /**
61 | * @brief Links a compatible diskio driver and increments the number of active
62 | * linked drivers.
63 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits
64 | * @param drv: pointer to the disk IO Driver structure
65 | * @param path: pointer to the logical drive path
66 | * @retval Returns 0 in case of success, otherwise 1.
67 | */
68 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
69 | {
70 | return FATFS_LinkDriverEx(drv, path, 0);
71 | }
72 |
73 | /**
74 | * @brief Unlinks a diskio driver and decrements the number of active linked
75 | * drivers.
76 | * @param path: pointer to the logical drive path
77 | * @param lun : not used
78 | * @retval Returns 0 in case of success, otherwise 1.
79 | */
80 | uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun)
81 | {
82 | uint8_t DiskNum = 0;
83 | uint8_t ret = 1;
84 |
85 | if(disk.nbr >= 1)
86 | {
87 | DiskNum = path[0] - '0';
88 | if(disk.drv[DiskNum] != 0)
89 | {
90 | disk.drv[DiskNum] = 0;
91 | disk.lun[DiskNum] = 0;
92 | disk.nbr--;
93 | ret = 0;
94 | }
95 | }
96 |
97 | return ret;
98 | }
99 |
100 | /**
101 | * @brief Unlinks a diskio driver and decrements the number of active linked
102 | * drivers.
103 | * @param path: pointer to the logical drive path
104 | * @retval Returns 0 in case of success, otherwise 1.
105 | */
106 | uint8_t FATFS_UnLinkDriver(char *path)
107 | {
108 | return FATFS_UnLinkDriverEx(path, 0);
109 | }
110 |
111 | /**
112 | * @brief Gets number of linked drivers to the FatFs module.
113 | * @param None
114 | * @retval Number of attached drivers.
115 | */
116 | uint8_t FATFS_GetAttachedDriversNbr(void)
117 | {
118 | return disk.nbr;
119 | }
120 |
121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
122 |
123 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Middlewares/Third_Party/FatFs/src/ff_gen_drv.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file ff_gen_drv.h
4 | * @author MCD Application Team
5 | * @brief Header for ff_gen_drv.c module.
6 | *****************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | **/
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __FF_GEN_DRV_H
21 | #define __FF_GEN_DRV_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "diskio.h"
29 | #include "ff.h"
30 | #include "stdint.h"
31 |
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 |
35 | /**
36 | * @brief Disk IO Driver structure definition
37 | */
38 | typedef struct
39 | {
40 | DSTATUS (*disk_initialize) (BYTE); /*!< Initialize Disk Drive */
41 | DSTATUS (*disk_status) (BYTE); /*!< Get Disk Status */
42 | DRESULT (*disk_read) (BYTE, BYTE*, DWORD, UINT); /*!< Read Sector(s) */
43 | #if _USE_WRITE == 1
44 | DRESULT (*disk_write) (BYTE, const BYTE*, DWORD, UINT); /*!< Write Sector(s) when _USE_WRITE = 0 */
45 | #endif /* _USE_WRITE == 1 */
46 | #if _USE_IOCTL == 1
47 | DRESULT (*disk_ioctl) (BYTE, BYTE, void*); /*!< I/O control operation when _USE_IOCTL = 1 */
48 | #endif /* _USE_IOCTL == 1 */
49 |
50 | }Diskio_drvTypeDef;
51 |
52 | /**
53 | * @brief Global Disk IO Drivers structure definition
54 | */
55 | typedef struct
56 | {
57 | uint8_t is_initialized[_VOLUMES];
58 | const Diskio_drvTypeDef *drv[_VOLUMES];
59 | uint8_t lun[_VOLUMES];
60 | volatile uint8_t nbr;
61 |
62 | }Disk_drvTypeDef;
63 |
64 | /* Exported constants --------------------------------------------------------*/
65 | /* Exported macro ------------------------------------------------------------*/
66 | /* Exported functions ------------------------------------------------------- */
67 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path);
68 | uint8_t FATFS_UnLinkDriver(char *path);
69 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, BYTE lun);
70 | uint8_t FATFS_UnLinkDriverEx(char *path, BYTE lun);
71 | uint8_t FATFS_GetAttachedDriversNbr(void);
72 |
73 | #ifdef __cplusplus
74 | }
75 | #endif
76 |
77 | #endif /* __FF_GEN_DRV_H */
78 |
79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
80 |
81 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Middlewares/Third_Party/FatFs/src/integer.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------*/
2 | /* Integer type definitions for FatFs module */
3 | /*-------------------------------------------*/
4 |
5 | #ifndef _FF_INTEGER
6 | #define _FF_INTEGER
7 |
8 | #ifdef _WIN32 /* FatFs development platform */
9 |
10 | #include
11 | #include
12 | typedef unsigned __int64 QWORD;
13 |
14 |
15 | #else /* Embedded platform */
16 |
17 | /* These types MUST be 16-bit or 32-bit */
18 | typedef int INT;
19 | typedef unsigned int UINT;
20 |
21 | /* This type MUST be 8-bit */
22 | typedef unsigned char BYTE;
23 |
24 | /* These types MUST be 16-bit */
25 | typedef short SHORT;
26 | typedef unsigned short WORD;
27 | typedef unsigned short WCHAR;
28 |
29 | /* These types MUST be 32-bit */
30 | typedef long LONG;
31 | typedef unsigned long DWORD;
32 |
33 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
34 | typedef unsigned long long QWORD;
35 |
36 | #endif
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/Quectel/bootloader/bootloader.h:
--------------------------------------------------------------------------------
1 | #ifndef __BOOTLOADER_H__
2 | #define __BOOTLOADER_H__
3 |
4 | typedef unsigned char u8_t;
5 | typedef signed char s8_t;
6 | typedef unsigned short u16_t;
7 | typedef signed short s16_t;
8 | typedef unsigned int u32_t;
9 | typedef unsigned long long u64_t;
10 | typedef signed int s32_t;
11 | typedef __IO u64_t vu64_t;
12 | typedef __IO u32_t vu32_t;
13 | typedef __IO u16_t vu16_t;
14 | typedef __IO u8_t vu8_t;
15 |
16 | #define ALIGN_UP(x, a) ( ( ((x) + ((a) - 1) ) / a ) * a )
17 | #define ALIGN_DOWN(x, a) ( ( (x) / (a)) * (a) )
18 |
19 | //Start address of the FLASH sector
20 | //Main memory
21 | #define ADDR_FLASH_SECTOR_0 ((u32_t)0x08000000) //Sector 0 start address, 16 Kbytes
22 | #define ADDR_FLASH_SECTOR_1 ((u32_t)0x08004000) //Sector 1 start address, 16 Kbytes
23 | #define ADDR_FLASH_SECTOR_2 ((u32_t)0x08008000) //Sector 2 start address, 16 Kbytes
24 | #define ADDR_FLASH_SECTOR_3 ((u32_t)0x0800C000) //Sector 3 start address, 16 Kbytes
25 | #define ADDR_FLASH_SECTOR_4 ((u32_t)0x08010000) //Sector 4 start address, 64 Kbytes
26 | #define ADDR_FLASH_SECTOR_5 ((u32_t)0x08020000) //Sector 5 start address, 128 Kbytes
27 | #define ADDR_FLASH_SECTOR_6 ((u32_t)0x08040000) //Sector 6 start address, 128 Kbytes
28 | #define ADDR_FLASH_SECTOR_7 ((u32_t)0x08060000) //Sector 7 start address, 128 Kbytes
29 | //System memory
30 | #define ADDR_FLASH_SYSTEM ((u32_t)0x1FFFF0000) //System start address, 30 Kbytes
31 | //OTP area
32 | #define ADDR_FLASH_otp ((u32_t)0x1FFFF7800) //System start address, 528 bytes
33 | //Option bytes
34 | #define ADDR_FLASH_otp ((u32_t)0x1FFFFC000) //System start address, 16 bytes
35 |
36 | #define STM32_FLASH_SIZE (64*1024) //FLASH capacity of the selected STM32 (in bytes)
37 | #define STM_SECTOR_SIZE (16*1024) //Note: The FLASH sector size of STM32F401ret6 is 16K
38 | #define STM32_FLASH_BASE ADDR_FLASH_SECTOR_0 //STM32 FLASH start address
39 | #define FLASH_APP1_ADDR ADDR_FLASH_SECTOR_4 //Application start address
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/STM32F401RETX_FLASH.ld:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | **
4 | ** @file : LinkerScript.ld
5 | **
6 | ** @author : Auto-generated by STM32CubeIDE
7 | **
8 | ** @brief : Linker script for STM32F401RETx Device from STM32F4 series
9 | ** 512KBytes FLASH
10 | ** 96KBytes RAM
11 | **
12 | ** Set heap size, stack size and stack location according
13 | ** to application requirements.
14 | **
15 | ** Set memory bank area and size if external memory is used
16 | **
17 | ** Target : STMicroelectronics STM32
18 | **
19 | ** Distribution: The file is distributed as is, without any warranty
20 | ** of any kind.
21 | **
22 | ******************************************************************************
23 | ** @attention
24 | **
25 | ** Copyright (c) 2024 STMicroelectronics.
26 | ** All rights reserved.
27 | **
28 | ** This software is licensed under terms that can be found in the LICENSE file
29 | ** in the root directory of this software component.
30 | ** If no LICENSE file comes with this software, it is provided AS-IS.
31 | **
32 | ******************************************************************************
33 | */
34 |
35 | /* Entry Point */
36 | ENTRY(Reset_Handler)
37 |
38 | /* Highest address of the user mode stack */
39 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
40 |
41 | _Min_Heap_Size = 0x200; /* required amount of heap */
42 | _Min_Stack_Size = 0x400; /* required amount of stack */
43 |
44 | /* Memories definition */
45 | MEMORY
46 | {
47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
48 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
49 | }
50 |
51 | /* Sections */
52 | SECTIONS
53 | {
54 | /* The startup code into "FLASH" Rom type memory */
55 | .isr_vector :
56 | {
57 | . = ALIGN(4);
58 | KEEP(*(.isr_vector)) /* Startup code */
59 | . = ALIGN(4);
60 | } >FLASH
61 |
62 | /* The program code and other data into "FLASH" Rom type memory */
63 | .text :
64 | {
65 | . = ALIGN(4);
66 | *(.text) /* .text sections (code) */
67 | *(.text*) /* .text* sections (code) */
68 | *(.glue_7) /* glue arm to thumb code */
69 | *(.glue_7t) /* glue thumb to arm code */
70 | *(.eh_frame)
71 |
72 | KEEP (*(.init))
73 | KEEP (*(.fini))
74 |
75 | . = ALIGN(4);
76 | _etext = .; /* define a global symbols at end of code */
77 | } >FLASH
78 |
79 | /* Constant data into "FLASH" Rom type memory */
80 | .rodata :
81 | {
82 | . = ALIGN(4);
83 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
84 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
85 | . = ALIGN(4);
86 | } >FLASH
87 |
88 | .ARM.extab : {
89 | . = ALIGN(4);
90 | *(.ARM.extab* .gnu.linkonce.armextab.*)
91 | . = ALIGN(4);
92 | } >FLASH
93 |
94 | .ARM : {
95 | . = ALIGN(4);
96 | __exidx_start = .;
97 | *(.ARM.exidx*)
98 | __exidx_end = .;
99 | . = ALIGN(4);
100 | } >FLASH
101 |
102 | .preinit_array :
103 | {
104 | . = ALIGN(4);
105 | PROVIDE_HIDDEN (__preinit_array_start = .);
106 | KEEP (*(.preinit_array*))
107 | PROVIDE_HIDDEN (__preinit_array_end = .);
108 | . = ALIGN(4);
109 | } >FLASH
110 |
111 | .init_array :
112 | {
113 | . = ALIGN(4);
114 | PROVIDE_HIDDEN (__init_array_start = .);
115 | KEEP (*(SORT(.init_array.*)))
116 | KEEP (*(.init_array*))
117 | PROVIDE_HIDDEN (__init_array_end = .);
118 | . = ALIGN(4);
119 | } >FLASH
120 |
121 | .fini_array :
122 | {
123 | . = ALIGN(4);
124 | PROVIDE_HIDDEN (__fini_array_start = .);
125 | KEEP (*(SORT(.fini_array.*)))
126 | KEEP (*(.fini_array*))
127 | PROVIDE_HIDDEN (__fini_array_end = .);
128 | . = ALIGN(4);
129 | } >FLASH
130 |
131 | /* Used by the startup to initialize data */
132 | _sidata = LOADADDR(.data);
133 |
134 | /* Initialized data sections into "RAM" Ram type memory */
135 | .data :
136 | {
137 | . = ALIGN(4);
138 | _sdata = .; /* create a global symbol at data start */
139 | *(.data) /* .data sections */
140 | *(.data*) /* .data* sections */
141 | *(.RamFunc) /* .RamFunc sections */
142 | *(.RamFunc*) /* .RamFunc* sections */
143 |
144 | . = ALIGN(4);
145 | _edata = .; /* define a global symbol at data end */
146 |
147 | } >RAM AT> FLASH
148 |
149 | /* Uninitialized data section into "RAM" Ram type memory */
150 | . = ALIGN(4);
151 | .bss :
152 | {
153 | /* This is used by the startup in order to initialize the .bss section */
154 | _sbss = .; /* define a global symbol at bss start */
155 | __bss_start__ = _sbss;
156 | *(.bss)
157 | *(.bss*)
158 | *(COMMON)
159 |
160 | . = ALIGN(4);
161 | _ebss = .; /* define a global symbol at bss end */
162 | __bss_end__ = _ebss;
163 | } >RAM
164 |
165 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
166 | ._user_heap_stack :
167 | {
168 | . = ALIGN(8);
169 | PROVIDE ( end = . );
170 | PROVIDE ( _end = . );
171 | . = . + _Min_Heap_Size;
172 | . = . + _Min_Stack_Size;
173 | . = ALIGN(8);
174 | } >RAM
175 |
176 | /* Remove information from the compiler libraries */
177 | /DISCARD/ :
178 | {
179 | libc.a ( * )
180 | libm.a ( * )
181 | libgcc.a ( * )
182 | }
183 |
184 | .ARM.attributes 0 : { *(.ARM.attributes) }
185 | }
186 |
--------------------------------------------------------------------------------
/source/STM32F401RET6_IAP/STM32F401RETX_RAM.ld:
--------------------------------------------------------------------------------
1 | /*
2 | ******************************************************************************
3 | **
4 | ** @file : LinkerScript.ld (debug in RAM dedicated)
5 | **
6 | ** @author : Auto-generated by STM32CubeIDE
7 | **
8 | ** @brief : Linker script for STM32F401RETx Device from STM32F4 series
9 | ** 512KBytes FLASH
10 | ** 96KBytes RAM
11 | **
12 | ** Set heap size, stack size and stack location according
13 | ** to application requirements.
14 | **
15 | ** Set memory bank area and size if external memory is used
16 | **
17 | ** Target : STMicroelectronics STM32
18 | **
19 | ** Distribution: The file is distributed as is, without any warranty
20 | ** of any kind.
21 | **
22 | ******************************************************************************
23 | ** @attention
24 | **
25 | ** Copyright (c) 2024 STMicroelectronics.
26 | ** All rights reserved.
27 | **
28 | ** This software is licensed under terms that can be found in the LICENSE file
29 | ** in the root directory of this software component.
30 | ** If no LICENSE file comes with this software, it is provided AS-IS.
31 | **
32 | ******************************************************************************
33 | */
34 |
35 | /* Entry Point */
36 | ENTRY(Reset_Handler)
37 |
38 | /* Highest address of the user mode stack */
39 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
40 |
41 | _Min_Heap_Size = 0x200; /* required amount of heap */
42 | _Min_Stack_Size = 0x400; /* required amount of stack */
43 |
44 | /* Memories definition */
45 | MEMORY
46 | {
47 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
48 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
49 | }
50 |
51 | /* Sections */
52 | SECTIONS
53 | {
54 | /* The startup code into "RAM" Ram type memory */
55 | .isr_vector :
56 | {
57 | . = ALIGN(4);
58 | KEEP(*(.isr_vector)) /* Startup code */
59 | . = ALIGN(4);
60 | } >RAM
61 |
62 | /* The program code and other data into "RAM" Ram type memory */
63 | .text :
64 | {
65 | . = ALIGN(4);
66 | *(.text) /* .text sections (code) */
67 | *(.text*) /* .text* sections (code) */
68 | *(.glue_7) /* glue arm to thumb code */
69 | *(.glue_7t) /* glue thumb to arm code */
70 | *(.eh_frame)
71 | *(.RamFunc) /* .RamFunc sections */
72 | *(.RamFunc*) /* .RamFunc* sections */
73 |
74 | KEEP (*(.init))
75 | KEEP (*(.fini))
76 |
77 | . = ALIGN(4);
78 | _etext = .; /* define a global symbols at end of code */
79 | } >RAM
80 |
81 | /* Constant data into "RAM" Ram type memory */
82 | .rodata :
83 | {
84 | . = ALIGN(4);
85 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
86 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
87 | . = ALIGN(4);
88 | } >RAM
89 |
90 | .ARM.extab : {
91 | . = ALIGN(4);
92 | *(.ARM.extab* .gnu.linkonce.armextab.*)
93 | . = ALIGN(4);
94 | } >RAM
95 |
96 | .ARM : {
97 | . = ALIGN(4);
98 | __exidx_start = .;
99 | *(.ARM.exidx*)
100 | __exidx_end = .;
101 | . = ALIGN(4);
102 | } >RAM
103 |
104 | .preinit_array :
105 | {
106 | . = ALIGN(4);
107 | PROVIDE_HIDDEN (__preinit_array_start = .);
108 | KEEP (*(.preinit_array*))
109 | PROVIDE_HIDDEN (__preinit_array_end = .);
110 | . = ALIGN(4);
111 | } >RAM
112 |
113 | .init_array :
114 | {
115 | . = ALIGN(4);
116 | PROVIDE_HIDDEN (__init_array_start = .);
117 | KEEP (*(SORT(.init_array.*)))
118 | KEEP (*(.init_array*))
119 | PROVIDE_HIDDEN (__init_array_end = .);
120 | . = ALIGN(4);
121 | } >RAM
122 |
123 | .fini_array :
124 | {
125 | . = ALIGN(4);
126 | PROVIDE_HIDDEN (__fini_array_start = .);
127 | KEEP (*(SORT(.fini_array.*)))
128 | KEEP (*(.fini_array*))
129 | PROVIDE_HIDDEN (__fini_array_end = .);
130 | . = ALIGN(4);
131 | } >RAM
132 |
133 | /* Used by the startup to initialize data */
134 | _sidata = LOADADDR(.data);
135 |
136 | /* Initialized data sections into "RAM" Ram type memory */
137 | .data :
138 | {
139 | . = ALIGN(4);
140 | _sdata = .; /* create a global symbol at data start */
141 | *(.data) /* .data sections */
142 | *(.data*) /* .data* sections */
143 |
144 | . = ALIGN(4);
145 | _edata = .; /* define a global symbol at data end */
146 |
147 | } >RAM
148 |
149 | /* Uninitialized data section into "RAM" Ram type memory */
150 | . = ALIGN(4);
151 | .bss :
152 | {
153 | /* This is used by the startup in order to initialize the .bss section */
154 | _sbss = .; /* define a global symbol at bss start */
155 | __bss_start__ = _sbss;
156 | *(.bss)
157 | *(.bss*)
158 | *(COMMON)
159 |
160 | . = ALIGN(4);
161 | _ebss = .; /* define a global symbol at bss end */
162 | __bss_end__ = _ebss;
163 | } >RAM
164 |
165 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
166 | ._user_heap_stack :
167 | {
168 | . = ALIGN(8);
169 | PROVIDE ( end = . );
170 | PROVIDE ( _end = . );
171 | . = . + _Min_Heap_Size;
172 | . = . + _Min_Stack_Size;
173 | . = ALIGN(8);
174 | } >RAM
175 |
176 | /* Remove information from the compiler libraries */
177 | /DISCARD/ :
178 | {
179 | libc.a ( * )
180 | libm.a ( * )
181 | libgcc.a ( * )
182 | }
183 |
184 | .ARM.attributes 0 : { *(.ARM.attributes) }
185 | }
186 |
--------------------------------------------------------------------------------