Fix L012 build errors: restore init.h, pid include, printf retarget
- Fix broken init.h that recursively included itself - Use classic struct assignment for PLL init (Keil C99 compatibility) - Fix pid.c include path PID.h -> pid.h - Add __write for MicroLib printf - Add MDK/build.bat for headless Keil build on remote host Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
df78a2dd56
commit
e37b57d1a2
|
|
@ -0,0 +1,19 @@
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set "UV4=C:\Keil_v5\UV4\UV4.exe"
|
||||||
|
if not exist "%UV4%" set "UV4=D:\Keil_v5\UV4\UV4.exe"
|
||||||
|
if not exist "%UV4%" set "UV4=%ProgramFiles%\Keil_v5\UV4\UV4.exe"
|
||||||
|
if not exist "%UV4%" set "UV4=%ProgramFiles(x86)%\Keil_v5\UV4\UV4.exe"
|
||||||
|
|
||||||
|
if not exist "%UV4%" (
|
||||||
|
echo Keil UV4 not found. Edit build.bat and set UV4 path.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
pushd "%~dp0"
|
||||||
|
"%UV4%" -b QQT912_L012.uvprojx -o build.log
|
||||||
|
set "RC=%ERRORLEVEL%"
|
||||||
|
type build.log
|
||||||
|
popd
|
||||||
|
exit /b %RC%
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
#include "init.h"
|
#ifndef __INIT_H
|
||||||
|
#define __INIT_H
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
void RCC_Configuration(void);
|
||||||
|
void GPIOInit(void);
|
||||||
|
void ADC_Configuration(void);
|
||||||
|
void BTIM_init(void);
|
||||||
void ADC1_SampleCallback(void);
|
void ADC1_SampleCallback(void);
|
||||||
|
|
||||||
|
#endif /* __INIT_H */
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
void RCC_Configuration(void)
|
void RCC_Configuration(void)
|
||||||
{
|
{
|
||||||
PLL_InitTypeDef PLL_InitStruct = {
|
PLL_InitTypeDef PLL_InitStruct;
|
||||||
.ClockSource = SYSCTRL_PLL_SOURCE_HSI_48M,
|
|
||||||
.PLL_OutFreq = 64000000,
|
PLL_InitStruct.ClockSource = SYSCTRL_PLL_SOURCE_HSI_48M;
|
||||||
.SourceFreq = 48000000,
|
PLL_InitStruct.PLL_OutFreq = 64000000;
|
||||||
.WaitCycle = SYSCTRL_PLL_WAIT_CYCLE_2048
|
PLL_InitStruct.SourceFreq = 48000000;
|
||||||
};
|
PLL_InitStruct.WaitCycle = SYSCTRL_PLL_WAIT_CYCLE_2048;
|
||||||
|
|
||||||
SYSCTRL_HSI_Enable(HSIOSC_TO_HSI96MHZ);
|
SYSCTRL_HSI_Enable(HSIOSC_TO_HSI96MHZ);
|
||||||
SYSCTRL_HCLKPRS_Config(SYSCTRL_HCLK_DIV1);
|
SYSCTRL_HCLKPRS_Config(SYSCTRL_HCLK_DIV1);
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,32 @@ PUTCHAR_PROTOTYPE
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t __write(int handle, const unsigned char *buffer, size_t size)
|
||||||
|
{
|
||||||
|
size_t nChars = 0;
|
||||||
|
|
||||||
|
if (buffer == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handle != 1 && handle != 2)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; size != 0; --size)
|
||||||
|
{
|
||||||
|
UART_SendData(DEBUG_UARTx, *buffer++);
|
||||||
|
while (UART_GetFlagStatus(DEBUG_UARTx, UART_FLAG_TXE) == RESET)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
++nChars;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nChars;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
void assert_failed(uint8_t *file, uint32_t line)
|
void assert_failed(uint8_t *file, uint32_t line)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "PID.h"
|
#include "pid.h"
|
||||||
|
|
||||||
float SPEED_P,SPEED_I,SPEED_D=0;
|
float SPEED_P,SPEED_I,SPEED_D=0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue