Browse Source

debug灯闪烁

master
tianjialong 2 years ago
parent
commit
d7224a4938
  1. 16
      app/.mxproject
  2. 2
      app/Inc/stm32f4xx_hal_conf.h
  3. 52
      app/Inc/usart.h
  4. 9
      app/MDK-ARM/EventRecorderStub.scvd
  5. 2012
      app/MDK-ARM/app.uvguix.29643
  6. 381
      app/MDK-ARM/app.uvoptx
  7. 174
      app/MDK-ARM/app.uvprojx
  8. 96
      app/MDK-ARM/startup_stm32f407xx.lst
  9. 11
      app/Src/gpio.c
  10. 5
      app/Src/main.c
  11. 114
      app/Src/usart.c
  12. 59
      app/app.ioc
  13. 32
      src/hardware_main.c
  14. 2
      src/zassert.h
  15. 2
      src/zthread.c

16
app/.mxproject
File diff suppressed because it is too large
View File

2
app/Inc/stm32f4xx_hal_conf.h

@ -63,7 +63,7 @@
/* #define HAL_MMC_MODULE_ENABLED */
/* #define HAL_SPI_MODULE_ENABLED */
#define HAL_TIM_MODULE_ENABLED
/* #define HAL_UART_MODULE_ENABLED */
#define HAL_UART_MODULE_ENABLED
/* #define HAL_USART_MODULE_ENABLED */
/* #define HAL_IRDA_MODULE_ENABLED */
/* #define HAL_SMARTCARD_MODULE_ENABLED */

52
app/Inc/usart.h

@ -0,0 +1,52 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file usart.h
* @brief This file contains all the function prototypes for
* the usart.c file
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H__
#define __USART_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern UART_HandleTypeDef huart1;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_USART1_UART_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __USART_H__ */

9
app/MDK-ARM/EventRecorderStub.scvd

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
<component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component-->
<events>
</events>
</component_viewer>

2012
app/MDK-ARM/app.uvguix.29643
File diff suppressed because it is too large
View File

381
app/MDK-ARM/app.uvoptx
File diff suppressed because it is too large
View File

174
app/MDK-ARM/app.uvprojx

@ -10,6 +10,7 @@
<TargetName>app</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
@ -188,7 +189,7 @@
<hadIRAM2>1</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>0</useUlib>
<useUlib>1</useUlib>
<EndSel>0</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
@ -205,12 +206,12 @@
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>1</Ir2Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>1</Im2Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
@ -300,12 +301,12 @@
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x1c000</Size>
<Size>0x20000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x2001c000</StartAddress>
<Size>0x4000</Size>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
@ -335,10 +336,10 @@
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<MiscControls>--diag_suppress=381 --diag_suppress=1 --diag_suppress=177 --diag_suppress=111 --diag_suppress=1295</MiscControls>
<Define>USE_HAL_DRIVER,STM32F407xx</Define>
<Undefine></Undefine>
<IncludePath>../Inc;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include</IncludePath>
<IncludePath>../Inc;../Middlewares/Third_Party/LwIP/src/include;../Middlewares/Third_Party/LwIP/system;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/BSP/Components/lan8742;../Middlewares/Third_Party/LwIP/src/include/netif/ppp;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Middlewares/Third_Party/LwIP/src/include/lwip;../Middlewares/Third_Party/LwIP/src/include/lwip/apps;../Middlewares/Third_Party/LwIP/src/include/lwip/priv;../Middlewares/Third_Party/LwIP/src/include/lwip/prot;../Middlewares/Third_Party/LwIP/src/include/netif;../Middlewares/Third_Party/LwIP/src/include/compat/posix;../Middlewares/Third_Party/LwIP/src/include/compat/posix/arpa;../Middlewares/Third_Party/LwIP/src/include/compat/posix/net;../Middlewares/Third_Party/LwIP/src/include/compat/posix/sys;../Middlewares/Third_Party/LwIP/src/include/compat/stdc;../Middlewares/Third_Party/LwIP/system/arch;../Drivers/CMSIS/Include;../../iflytop_microcontroller;../../iflytop_microcontroller/sdk/stm32;../../src</IncludePath>
</VariousControls>
</Cads>
<Aads>
@ -428,6 +429,62 @@
<FilePath>../Src/tim.c</FilePath>
</File>
<File>
<FileName>usart.c</FileName>
<FileType>1</FileType>
<FilePath>../Src/usart.c</FilePath>
<FileOption>
<CommonProperty>
<UseCPPCompiler>2</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>2</AlwaysBuild>
<GenerateAssemblyFile>2</GenerateAssemblyFile>
<AssembleAssemblyFile>2</AssembleAssemblyFile>
<PublicsOnly>2</PublicsOnly>
<StopOnExitCode>11</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<FileArmAds>
<Cads>
<interw>2</interw>
<Optim>0</Optim>
<oTime>2</oTime>
<SplitLS>2</SplitLS>
<OneElfS>2</OneElfS>
<Strict>2</Strict>
<EnumInt>2</EnumInt>
<PlainCh>2</PlainCh>
<Ropi>2</Ropi>
<Rwpi>2</Rwpi>
<wLevel>0</wLevel>
<uThumb>2</uThumb>
<uSurpInc>2</uSurpInc>
<uC99>2</uC99>
<uGnu>2</uGnu>
<useXO>2</useXO>
<v6Lang>0</v6Lang>
<v6LangP>0</v6LangP>
<vShortEn>2</vShortEn>
<vShortWch>2</vShortWch>
<v6Lto>2</v6Lto>
<v6WtE>2</v6WtE>
<v6Rtti>2</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Cads>
</FileArmAds>
</FileOption>
</File>
<File>
<FileName>stm32f4xx_it.c</FileName>
<FileType>1</FileType>
<FilePath>../Src/stm32f4xx_it.c</FilePath>
@ -542,6 +599,62 @@
<FileType>1</FileType>
<FilePath>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c</FilePath>
</File>
<File>
<FileName>stm32f4xx_hal_uart.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c</FilePath>
<FileOption>
<CommonProperty>
<UseCPPCompiler>2</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>2</AlwaysBuild>
<GenerateAssemblyFile>2</GenerateAssemblyFile>
<AssembleAssemblyFile>2</AssembleAssemblyFile>
<PublicsOnly>2</PublicsOnly>
<StopOnExitCode>11</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<FileArmAds>
<Cads>
<interw>2</interw>
<Optim>0</Optim>
<oTime>2</oTime>
<SplitLS>2</SplitLS>
<OneElfS>2</OneElfS>
<Strict>2</Strict>
<EnumInt>2</EnumInt>
<PlainCh>2</PlainCh>
<Ropi>2</Ropi>
<Rwpi>2</Rwpi>
<wLevel>0</wLevel>
<uThumb>2</uThumb>
<uSurpInc>2</uSurpInc>
<uC99>2</uC99>
<uGnu>2</uGnu>
<useXO>2</useXO>
<v6Lang>0</v6Lang>
<v6LangP>0</v6LangP>
<vShortEn>2</vShortEn>
<vShortWch>2</vShortWch>
<v6Lto>2</v6Lto>
<v6WtE>2</v6WtE>
<v6Rtti>2</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Cads>
</FileArmAds>
</FileOption>
</File>
</Files>
</Group>
<Group>
@ -1020,6 +1133,51 @@
</Files>
</Group>
<Group>
<GroupName>iflytop</GroupName>
<Files>
<File>
<FileName>stm32sdk.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\iflytop_microcontroller\sdk\stm32\stm32sdk.c</FilePath>
</File>
<File>
<FileName>pwm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\iflytop_microcontroller\sdk\stm32\pwm.c</FilePath>
</File>
<File>
<FileName>zkey.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\iflytop_microcontroller\zkey\std\zkey.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>src</GroupName>
<Files>
<File>
<FileName>hardware_main.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\hardware_main.c</FilePath>
</File>
<File>
<FileName>protocol.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\protocol.c</FilePath>
</File>
<File>
<FileName>zflash.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\zflash.c</FilePath>
</File>
<File>
<FileName>zport.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\zport.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>

96
app/MDK-ARM/startup_stm32f407xx.lst

@ -464,9 +464,9 @@ ARM Macro Assembler Page 8
171 00000000 IMPORT SystemInit
172 00000000 IMPORT __main
173 00000000
174 00000000 4809 LDR R0, =SystemInit
174 00000000 4806 LDR R0, =SystemInit
175 00000002 4780 BLX R0
176 00000004 4809 LDR R0, =__main
176 00000004 4806 LDR R0, =__main
177 00000006 4700 BX R0
178 00000008 ENDP
179 00000008
@ -818,42 +818,25 @@ ARM Macro Assembler Page 13
398 0000001C ;*******************************************************
************************
399 0000001C IF :DEF:__MICROLIB
406 0000001C
407 0000001C IMPORT __use_two_region_memory
408 0000001C EXPORT __user_initial_stackheap
409 0000001C
410 0000001C __user_initial_stackheap
411 0000001C
412 0000001C 4804 LDR R0, = Heap_Mem
413 0000001E 4905 LDR R1, =(Stack_Mem + Stack_Size)
414 00000020 4A05 LDR R2, = (Heap_Mem + Heap_Size)
415 00000022 4B06 LDR R3, = Stack_Mem
416 00000024 4770 BX LR
417 00000026
418 00000026 00 00 ALIGN
419 00000028
420 00000028 ENDIF
421 00000028
422 00000028 END
400 0000001C
401 0000001C EXPORT __initial_sp
402 0000001C EXPORT __heap_base
403 0000001C EXPORT __heap_limit
404 0000001C
405 0000001C ELSE
420 ENDIF
421 0000001C
422 0000001C END
00000000
00000000
00000000
00000400
00000200
00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M4.fp.sp --apcs=
interwork --depend=app\startup_stm32f407xx.d -oapp\startup_stm32f407xx.o -I..\I
ARM Macro Assembler Page 14
nc -I.\RTE\_app -IC:\Users\29643\AppData\Local\Arm\Packs\ARM\CMSIS\5.8.0\CMSIS\
Core\Include -IC:\Users\29643\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.16.0
\Drivers\CMSIS\Device\ST\STM32F4xx\Include --predefine="__UVISION_VERSION SETA
535" --predefine="_RTE_ SETA 1" --predefine="STM32F407xx SETA 1" --predefine="_
RTE_ SETA 1" --list=startup_stm32f407xx.lst startup_stm32f407xx.s
\Drivers\CMSIS\Device\ST\STM32F4xx\Include --predefine="__MICROLIB SETA 1" --pr
edefine="__UVISION_VERSION SETA 535" --predefine="_RTE_ SETA 1" --predefine="ST
M32F407xx SETA 1" --predefine="_RTE_ SETA 1" --list=startup_stm32f407xx.lst sta
rtup_stm32f407xx.s
@ -874,9 +857,8 @@ Symbol: Stack_Mem
Definitions
At line 35 in file startup_stm32f407xx.s
Uses
At line 413 in file startup_stm32f407xx.s
At line 415 in file startup_stm32f407xx.s
None
Comment: Stack_Mem unused
__initial_sp 00000400
Symbol: __initial_sp
@ -884,7 +866,8 @@ Symbol: __initial_sp
At line 36 in file startup_stm32f407xx.s
Uses
At line 60 in file startup_stm32f407xx.s
Comment: __initial_sp used once
At line 401 in file startup_stm32f407xx.s
3 symbols
@ -906,25 +889,24 @@ Symbol: Heap_Mem
Definitions
At line 47 in file startup_stm32f407xx.s
Uses
At line 412 in file startup_stm32f407xx.s
At line 414 in file startup_stm32f407xx.s
None
Comment: Heap_Mem unused
__heap_base 00000000
Symbol: __heap_base
Definitions
At line 46 in file startup_stm32f407xx.s
Uses
None
Comment: __heap_base unused
At line 402 in file startup_stm32f407xx.s
Comment: __heap_base used once
__heap_limit 00000200
Symbol: __heap_limit
Definitions
At line 48 in file startup_stm32f407xx.s
Uses
None
Comment: __heap_limit unused
At line 403 in file startup_stm32f407xx.s
Comment: __heap_limit used once
4 symbols
@ -1884,15 +1866,7 @@ Symbol: WWDG_IRQHandler
At line 78 in file startup_stm32f407xx.s
At line 226 in file startup_stm32f407xx.s
__user_initial_stackheap 0000001C
Symbol: __user_initial_stackheap
Definitions
At line 410 in file startup_stm32f407xx.s
Uses
At line 408 in file startup_stm32f407xx.s
Comment: __user_initial_stackheap used once
94 symbols
93 symbols
@ -1906,8 +1880,7 @@ Symbol: Heap_Size
At line 43 in file startup_stm32f407xx.s
Uses
At line 47 in file startup_stm32f407xx.s
At line 414 in file startup_stm32f407xx.s
Comment: Heap_Size used once
Stack_Size 00000400
Symbol: Stack_Size
@ -1915,8 +1888,7 @@ Symbol: Stack_Size
At line 32 in file startup_stm32f407xx.s
Uses
At line 35 in file startup_stm32f407xx.s
At line 413 in file startup_stm32f407xx.s
Comment: Stack_Size used once
__Vectors_Size 00000188
Symbol: __Vectors_Size
@ -1948,13 +1920,5 @@ Symbol: __main
Uses
At line 176 in file startup_stm32f407xx.s
Comment: __main used once
__use_two_region_memory 00000000
Symbol: __use_two_region_memory
Definitions
At line 407 in file startup_stm32f407xx.s
Uses
None
Comment: __use_two_region_memory unused
3 symbols
448 symbols in table
2 symbols
445 symbols in table

11
app/Src/gpio.c

@ -45,6 +45,7 @@ void MX_GPIO_Init(void)
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
@ -52,8 +53,18 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOG_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(ETH_RST_GPIO_Port, ETH_RST_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : PF9 */
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = ETH_RST_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

5
app/Src/main.c

@ -22,6 +22,7 @@
#include "iwdg.h"
#include "lwip.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
/* Private includes ----------------------------------------------------------*/
@ -91,8 +92,10 @@ int main(void)
MX_GPIO_Init();
MX_IWDG_Init();
MX_TIM6_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
extern void hardware_main();
hardware_main();
/* USER CODE END 2 */
/* Call init function for freertos objects (in freertos.c) */

114
app/Src/usart.c

@ -0,0 +1,114 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file usart.c
* @brief This file provides code for the configuration
* of the USART instances.
******************************************************************************
* @attention
*
* Copyright (c) 2023 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "usart.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
UART_HandleTypeDef huart1;
/* USART1 init function */
void MX_USART1_UART_Init(void)
{
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE END USART1_Init 0 */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */
/* USER CODE END USART1_Init 2 */
}
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(uartHandle->Instance==USART1)
{
/* USER CODE BEGIN USART1_MspInit 0 */
/* USER CODE END USART1_MspInit 0 */
/* USART1 clock enable */
__HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/**USART1 GPIO Configuration
PA9 ------> USART1_TX
PA10 ------> USART1_RX
*/
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN USART1_MspInit 1 */
/* USER CODE END USART1_MspInit 1 */
}
}
void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
{
if(uartHandle->Instance==USART1)
{
/* USER CODE BEGIN USART1_MspDeInit 0 */
/* USER CODE END USART1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USART1_CLK_DISABLE();
/**USART1 GPIO Configuration
PA9 ------> USART1_TX
PA10 ------> USART1_RX
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
/* USER CODE BEGIN USART1_MspDeInit 1 */
/* USER CODE END USART1_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */

59
app/app.ioc

@ -37,29 +37,33 @@ Mcu.IP4=NVIC
Mcu.IP5=RCC
Mcu.IP6=SYS
Mcu.IP7=TIM6
Mcu.IPNb=8
Mcu.IP8=USART1
Mcu.IPNb=9
Mcu.Name=STM32F407Z(E-G)Tx
Mcu.Package=LQFP144
Mcu.Pin0=PH0-OSC_IN
Mcu.Pin1=PH1-OSC_OUT
Mcu.Pin10=PD3
Mcu.Pin11=PG11
Mcu.Pin12=PG13
Mcu.Pin13=PG14
Mcu.Pin14=VP_FREERTOS_VS_CMSIS_V1
Mcu.Pin15=VP_IWDG_VS_IWDG
Mcu.Pin16=VP_LWIP_VS_Enabled
Mcu.Pin17=VP_SYS_VS_tim1
Mcu.Pin18=VP_TIM6_VS_ClockSourceINT
Mcu.Pin2=PC1
Mcu.Pin3=PA1
Mcu.Pin4=PA2
Mcu.Pin5=PA7
Mcu.Pin6=PC4
Mcu.Pin7=PC5
Mcu.Pin8=PA13
Mcu.Pin9=PA14
Mcu.PinsNb=19
Mcu.Pin0=PF9
Mcu.Pin1=PH0-OSC_IN
Mcu.Pin10=PA10
Mcu.Pin11=PA13
Mcu.Pin12=PA14
Mcu.Pin13=PD3
Mcu.Pin14=PG11
Mcu.Pin15=PG13
Mcu.Pin16=PG14
Mcu.Pin17=VP_FREERTOS_VS_CMSIS_V1
Mcu.Pin18=VP_IWDG_VS_IWDG
Mcu.Pin19=VP_LWIP_VS_Enabled
Mcu.Pin2=PH1-OSC_OUT
Mcu.Pin20=VP_SYS_VS_tim1
Mcu.Pin21=VP_TIM6_VS_ClockSourceINT
Mcu.Pin3=PC1
Mcu.Pin4=PA1
Mcu.Pin5=PA2
Mcu.Pin6=PA7
Mcu.Pin7=PC4
Mcu.Pin8=PC5
Mcu.Pin9=PA9
Mcu.PinsNb=22
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F407ZGTx
@ -85,6 +89,8 @@ NVIC.TimeBaseIP=TIM1
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
PA1.Mode=RMII
PA1.Signal=ETH_REF_CLK
PA10.Mode=Asynchronous
PA10.Signal=USART1_RX
PA13.Mode=Serial_Wire
PA13.Signal=SYS_JTMS-SWDIO
PA14.Mode=Serial_Wire
@ -93,6 +99,8 @@ PA2.Mode=RMII
PA2.Signal=ETH_MDIO
PA7.Mode=RMII
PA7.Signal=ETH_CRS_DV
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
PC1.Mode=RMII
PC1.Signal=ETH_MDC
PC4.Mode=RMII
@ -103,6 +111,11 @@ PD3.GPIOParameters=GPIO_Label
PD3.GPIO_Label=ETH_RST
PD3.Locked=true
PD3.Signal=GPIO_Output
PF9.GPIOParameters=GPIO_Speed,GPIO_PuPd
PF9.GPIO_PuPd=GPIO_PULLUP
PF9.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PF9.Locked=true
PF9.Signal=GPIO_Output
PG11.Locked=true
PG11.Mode=RMII
PG11.Signal=ETH_TX_EN
@ -144,7 +157,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5.32
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_IWDG_Init-IWDG-false-HAL-true,4-MX_TIM6_Init-TIM6-false-HAL-true,5-MX_LWIP_Init-LWIP-false-HAL-false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_IWDG_Init-IWDG-false-HAL-true,4-MX_TIM6_Init-TIM6-false-HAL-true,5-MX_LWIP_Init-LWIP-false-HAL-false,6-MX_USART1_UART_Init-USART1-false-HAL-true
RCC.48MHZClocksFreq_Value=84000000
RCC.AHBFreq_Value=168000000
RCC.APB1CLKDivider=RCC_HCLK_DIV4
@ -176,6 +189,8 @@ RCC.VCOI2SOutputFreq_Value=192000000
RCC.VCOInputFreq_Value=1000000
RCC.VCOOutputFreq_Value=336000000
RCC.VcooutputI2S=96000000
USART1.IPParameters=VirtualMode
USART1.VirtualMode=VM_ASYNC
VP_FREERTOS_VS_CMSIS_V1.Mode=CMSIS_V1
VP_FREERTOS_VS_CMSIS_V1.Signal=FREERTOS_VS_CMSIS_V1
VP_IWDG_VS_IWDG.Mode=IWDG_Activate

32
src/hardware_main.c

@ -4,35 +4,35 @@
#include <string.h>
#include "cmsis_os.h"
#include "config.h"
#include "encoder_acquistion_service.h"
// #include "config.h"
// #include "encoder_acquistion_service.h"
#include "iwdg.h"
#include "lwip.h"
#include "main.h"
#include "protocol.h"
#include "src/demosrc/freertos_demo.h"
#include "src/demosrc/malloc.h"
#include "src/demosrc/sram.h"
#include "usart.h"
// #include "src/demosrc/freertos_demo.h"
// #include "src/demosrc/malloc.h"
// #include "src/demosrc/sram.h"
// #include "usart.h"
#include "zboard.h"
#include "zport.h"
//
#include "iflytop_microcontroller/sdk/stm32/stm32sdk.h"
// #include "iflytop_microcontroller/sdk/stm32/stm32sdk.h"
#define TAG "HARDWARE_MAIN"
void hardware_main() {
sram_init(); /* SRAM初始化 */
// sram_init(); /* SRAM初始化 */
my_mem_init(SRAMIN); /* 初始化内部SRAM内存池 */
my_mem_init(SRAMEX); /* 初始化外部SRAM内存池 */
my_mem_init(SRAMCCM); /* 初始化内部CCM内存池 */
// my_mem_init(SRAMIN); /* 初始化内部SRAM内存池 */
// my_mem_init(SRAMEX); /* 初始化外部SRAM内存池 */
// my_mem_init(SRAMCCM); /* 初始化内部CCM内存池 */
freertos_demo();
// freertos_demo();
// ZLOGI(TAG, "start hardware test");
// while (1) {
// port_do_debug_light_state();
// HAL_IWDG_Refresh(&hiwdg);
// }
while (1) {
port_do_debug_light_state();
// HAL_IWDG_Refresh(&hiwdg);
}
}

2
src/zassert.h

@ -1,5 +1,5 @@
#pragma once
#include "iflytop_microcontroller/sdk/stm32/stm32sdk.h"
#include "stm32sdk.h"
#define Z_ASSERT(condition) \
if (!(condition)) { \
ZLOGI(TAG, "do " #condition " fail") \

2
src/zthread.c

@ -1,6 +1,6 @@
#include "zthread.h"
#include "stdbool.h"
#include "iflytop_microcontroller/sdk/stm32/stm32sdk.h"
#include "stm32sdk.h"
// #include "Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F\port.h"
#include "zassert.h"

Loading…
Cancel
Save