canbus adding filters
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
Debug/**
|
||||
Debug/
|
||||
build/
|
||||
/Release/
|
||||
|
@ -6,7 +6,7 @@
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="557024645362649502" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-54795925002487172" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@ -18,7 +18,7 @@
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="557024645362649502" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-54795925002487172" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -1,5 +1,5 @@
|
||||
2F62501ED4689FB349E356AB974DBE57=3C8163665DC52502E88D788B0CED9B35
|
||||
2F62501ED4689FB349E356AB974DBE57=E4D6F48A5E072BF280AE61DC22F0EFF9
|
||||
66BE74F758C12D739921AEA421D593D3=4
|
||||
8DF89ED150041C4CBC7CB9A9CAA90856=3C8163665DC52502E88D788B0CED9B35
|
||||
DC22A860405A8BF2F2C095E5B6529F12=3C6A73657F8CAB85FF62A66955B31FC6
|
||||
8DF89ED150041C4CBC7CB9A9CAA90856=E4D6F48A5E072BF280AE61DC22F0EFF9
|
||||
DC22A860405A8BF2F2C095E5B6529F12=F216BE080F2C17807F72AFE2348FF317
|
||||
eclipse.preferences.version=1
|
||||
|
24
.vscode/c_cpp_properties.json
vendored
Normal file
24
.vscode/c_cpp_properties.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "STM32",
|
||||
"includePath": [
|
||||
"Core",
|
||||
"Core/Application",
|
||||
"Core/Drivers",
|
||||
"Core/Inc",
|
||||
"Core/Toolbox",
|
||||
"Drivers/CMSIS/Device/ST/STM32L4xx/Include",
|
||||
"Drivers/CMSIS/Include",
|
||||
"Drivers/STM32L4xx_HAL_Driver/Inc",
|
||||
"Drivers/STM32L4xx_HAL_Driver/Inc/Legacy",
|
||||
"Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2",
|
||||
"Middlewares/Third_Party/FreeRTOS/Source/include",
|
||||
"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.3.1/.content/bin/arm-none-eabi-gcc"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
18
.vscode/launch.json
vendored
Normal file
18
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"showDevDebugOutput": true,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"executable": "./build/.elf",
|
||||
"name": "Debug STM32",
|
||||
"request": "launch",
|
||||
"type": "cortex-debug",
|
||||
"servertype": "openocd",
|
||||
"preLaunchTask": "Build STM",
|
||||
"device": "stlink",
|
||||
"configFiles": [
|
||||
"openocd.cfg"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,5 +1,8 @@
|
||||
{
|
||||
"C_Cpp.errorSquiggles": "Disabled",
|
||||
"cortex-debug.armToolchainPath": "/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.3.1/.content/bin",
|
||||
"cortex-debug.openocdPath": "/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-2.1/.content/bin/openocd"
|
||||
"cortex-debug.openocdPath": "/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-2.1/.content/bin/openocd",
|
||||
"files.associations": {
|
||||
"peco_peltiercontroller.h": "c"
|
||||
}
|
||||
}
|
50
.vscode/tasks.json
vendored
Normal file
50
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build STM",
|
||||
"type": "process",
|
||||
"command": "${command:stm32-for-vscode.build}",
|
||||
"options": {
|
||||
"cwd": "${workspaceRoot}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Build Clean STM",
|
||||
"type": "process",
|
||||
"command": "${command:stm32-for-vscode.cleanBuild}",
|
||||
"options": {
|
||||
"cwd": "${workspaceRoot}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Flash STM",
|
||||
"type": "process",
|
||||
"command": "${command:stm32-for-vscode.flash}",
|
||||
"options": {
|
||||
"cwd": "${workspaceRoot}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -57,17 +57,17 @@
|
||||
// Description: Definition of local constants (visible by this module only).
|
||||
//=================================================================================================
|
||||
|
||||
#define SLOW_TEXT (U32)0x83767987
|
||||
#define FAST_TEXT (U32)0x46415354
|
||||
|
||||
#define MSG_QUEUE_SIZE 8
|
||||
|
||||
|
||||
#define EVENT_NEW_MESSAGE ((U32)(1<<0))
|
||||
#define EVENT_TIMER_UPDATE ((U32)(1<<1))
|
||||
|
||||
#define EVENT_FLAGS_ALL ( EVENT_NEW_MESSAGE | EVENT_TIMER_UPDATE )
|
||||
|
||||
#define MESSAGE_TYPE_READ 0
|
||||
#define MESSAGE_TYPE_WRITE 1
|
||||
#define MESSAGE_TYPE_COMMAND 2
|
||||
|
||||
//=================================================================================================
|
||||
// Section: MACROS
|
||||
// Description: Definition of local macros (visible by this module only).
|
||||
@ -107,13 +107,8 @@ LOCAL osThreadId_t m_pstThreadID = NULL;
|
||||
LOCAL osMessageQueueId_t m_pstCANRxMsgQueueID = NULL;
|
||||
LOCAL osEventFlagsId_t m_pstEventID = NULL;
|
||||
|
||||
|
||||
|
||||
LOCAL osTimerId_t m_pstUpdateTimer = NULL;
|
||||
|
||||
|
||||
LOCAL U32 m_u32DataCnt = 0;
|
||||
|
||||
//=================================================================================================
|
||||
// Section: LOCAL CONSTANTS
|
||||
// Description: Definition of local constants (visible by this module only).
|
||||
@ -232,13 +227,17 @@ PRIVATE VOID vTask( PVOID arg )
|
||||
CAND_Message stMessage;
|
||||
osMessageQueueGet( m_pstCANRxMsgQueueID, &stMessage, NULL, 0 );
|
||||
|
||||
if( stMessage.u8Id == 0x12 ){
|
||||
U8 u8Register = stMessage.au8Data[0];
|
||||
U8 u8Typ = stMessage.au8Data[1];
|
||||
U32 u32Data = *(PU32)&stMessage.au8Data[2];
|
||||
|
||||
if( u8Register == 0x12 ){
|
||||
|
||||
S16 s16Voltage = stMessage.au8Data[0] << 8;
|
||||
s16Voltage |= stMessage.au8Data[1];
|
||||
VARH_vSetVariableDataFloat( VARH_eControlVoltage, (FLOAT)s16Voltage / 1000 );
|
||||
|
||||
} else if( stMessage.u8Id == 0x13 ){
|
||||
} else if( u8Register == 0x13 ){
|
||||
|
||||
S16 SupplyVoltage24V = (S16) ( VARH_flGetVariableData( VARH_eSupply_U ) * 1000 );
|
||||
S16 SupplyCurrent24V = (S16) ( VARH_flGetVariableData( VARH_eSupply_I ) * 1000 );
|
||||
@ -256,7 +255,7 @@ PRIVATE VOID vTask( PVOID arg )
|
||||
|
||||
CAND_boSendMessage( 0x14, 8, au8Buffer );
|
||||
|
||||
} else if( stMessage.u8Id == 0x15 ){
|
||||
} else if( u8Register == 0x15 ){
|
||||
|
||||
S16 Cold = (S16) ( VARH_flGetVariableData( VARH_eTemp_C ) * 100 );
|
||||
S16 Hot = (S16) ( VARH_flGetVariableData( VARH_eTemp_H ) * 100 );
|
||||
@ -268,11 +267,11 @@ PRIVATE VOID vTask( PVOID arg )
|
||||
|
||||
CAND_boSendMessage( 0x16, 4, au8Buffer );
|
||||
|
||||
} else if( stMessage.u8Id == 0x17 ){
|
||||
} else if( u8Register == 0x17 ){
|
||||
|
||||
PECO_Enable( TRUE );
|
||||
|
||||
} else if( stMessage.u8Id == 0x18 ){
|
||||
} else if( u8Register == 0x18 ){
|
||||
|
||||
PECO_Enable( FALSE );
|
||||
|
||||
|
@ -342,7 +342,7 @@ U8 VARH_uGetVariableFlags( U8 u8Variable )
|
||||
VOID VARH_vSetVariableToInitData( U8 u8Variable )
|
||||
{
|
||||
osMutexAcquire( m_pstMutexID, osWaitForever ); // aquire mutex
|
||||
VARH_vSetVariableDataFromSystem( u8Variable, m_astVarInfo[u8Variable].uInitData );
|
||||
vSetVariableDataFromSystem( u8Variable, m_astVarInfo[u8Variable].uInitData );
|
||||
osMutexRelease( m_pstMutexID ); // release mutex
|
||||
}
|
||||
|
||||
|
@ -139,9 +139,9 @@ BOOL ANPO_boInitializeModule( VOID )
|
||||
BOOL ANPO_boSetVoltage( FLOAT Voltage ){
|
||||
BOOL boOK = TRUE;
|
||||
|
||||
U32 RawData = u32ConvertVoltagetoRaw( Voltage );
|
||||
U32 u32RawData = u32ConvertVoltagetoRaw( Voltage );
|
||||
|
||||
boOK &= HAL_DAC_SetValue( &hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, RawDatab );
|
||||
boOK &= HAL_DAC_SetValue( &hdac1, DAC_CHANNEL_1, DAC_ALIGN_12B_R, u32RawData );
|
||||
|
||||
return( boOK );
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Project: Peltier Controller V2
|
||||
// Author: Noah Piqu<EFBFBD> (noah.pique@psi.ch)
|
||||
// Author: Noah Piqué (noah.pique@psi.ch)
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//
|
||||
@ -36,6 +36,9 @@
|
||||
// Toolbox
|
||||
#include "../Toolbox/UTIL_Utility.h"
|
||||
|
||||
// Driver
|
||||
#include "DIPO_DigitalPorts.h"
|
||||
|
||||
// include STM32 drivers
|
||||
#include "stm32l4xx_hal.h"
|
||||
|
||||
@ -46,7 +49,11 @@
|
||||
// Description: Definition of local constants (visible by this module only).
|
||||
//=================================================================================================
|
||||
|
||||
#define CAND_SHIFT 0x0 // Shift address space (0-3)
|
||||
#define CAND_BOARD_GROUP 0x03 // Board group (0-127 / 0x00-0x7F)
|
||||
|
||||
#define CAND_PRIVATE 1
|
||||
#define CAND_PUBLIC 0
|
||||
|
||||
//=================================================================================================
|
||||
// Section: MACROS
|
||||
@ -61,22 +68,31 @@
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Section: STRUCTURES
|
||||
// Description: Definition of local Structures (visible by this module only).
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Section: LOCAL VARIABLES
|
||||
// Description: Definition of local variables (visible by this module only).
|
||||
//=================================================================================================
|
||||
CAND_pfnRxCallback m_pfnRxCallback = NULL;
|
||||
|
||||
CAN_FilterTypeDef stFilter = {
|
||||
(CAND_SHIFT<<6)|(CAND_PUBLIC<<5)|(CAND_BOARD_GROUP<<1), // FilterIdHigh
|
||||
0x00, // FilterIdLow
|
||||
(CAND_SHIFT<<6)|(CAND_PRIVATE<<5)|(CAND_BOARD_GROUP<<1), // FilterMaskIdHigh
|
||||
0x00, // FilterMaskIdLow
|
||||
CAN_FILTER_FIFO0, // FilterFIFOAssignment
|
||||
0x00, // FilterBank
|
||||
CAN_FILTERMODE_IDLIST, // FilterMode
|
||||
CAN_FILTERSCALE_32BIT, // FilterScale
|
||||
CAN_FILTER_ENABLE, // FilterActivation
|
||||
0x00 // SlaveStartFilterBank
|
||||
};
|
||||
|
||||
//=================================================================================================
|
||||
// Section: LOCAL CONSTANTS
|
||||
// Description: Definition of local constants (visible by this module only).
|
||||
@ -118,6 +134,17 @@ BOOL CAND_boInitializeModule( VOID )
|
||||
{
|
||||
BOOL boOK = TRUE;
|
||||
|
||||
U8 u8BoardId = 0x00;
|
||||
u8BoardId |= DIPO_boGetInput(DIPO_eADR0) << 0;
|
||||
u8BoardId |= DIPO_boGetInput(DIPO_eADR1) << 1;
|
||||
u8BoardId |= DIPO_boGetInput(DIPO_eADR2) << 2;
|
||||
//u8BoardId |= DIPO_boGetInput(DIPO_eADR0) << 3; // TODO: New HW
|
||||
|
||||
stFilter.FilterIdHigh |= u8BoardId >> 3;
|
||||
stFilter.FilterIdLow |= u8BoardId << 5;
|
||||
|
||||
HAL_CAN_ConfigFilter(&hcan1, &stFilter);
|
||||
|
||||
boOK &= ( HAL_CAN_Start(&hcan1) == HAL_OK ) ? TRUE : FALSE;
|
||||
|
||||
boOK &= ( HAL_CAN_ActivateNotification( &hcan1, CAN_IT_RX_FIFO0_MSG_PENDING ) == HAL_OK ) ? TRUE : FALSE;
|
||||
@ -161,7 +188,6 @@ BOOL CAND_boSendMessage( U8 u8Id, U8 u8Len, PU8 pu8Buffer ){
|
||||
// Returns: none
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
VOID CAND_vSetRxCallback( CAND_pfnRxCallback pfnRxCallback ){
|
||||
|
||||
m_pfnRxCallback = pfnRxCallback;
|
||||
}
|
||||
|
||||
@ -188,7 +214,6 @@ void HAL_CAN_RxFifo0MsgPendingCallback( CAN_HandleTypeDef *hcan ){
|
||||
|
||||
CAND_Message stMessage;
|
||||
|
||||
stMessage.u8Id = header.StdId;
|
||||
stMessage.u8Len = header.DLC;
|
||||
UTIL_vMemCopy( au8Data,stMessage.au8Data,stMessage.u8Len );
|
||||
|
||||
|
@ -62,7 +62,6 @@ extern "C" {
|
||||
//=================================================================================================
|
||||
|
||||
typedef struct {
|
||||
U8 u8Id;
|
||||
U8 au8Data[8];
|
||||
U8 u8Len;
|
||||
} CAND_Message;
|
||||
|
@ -27,7 +27,7 @@ ADC1.SamplingTime-3\#ChannelRegularConversion=ADC_SAMPLETIME_640CYCLES_5
|
||||
ADC1.master=1
|
||||
CAN1.BS1=CAN_BS1_3TQ
|
||||
CAN1.CalculateBaudRate=1000000
|
||||
CAN1.CalculateTimeBit=1000.00
|
||||
CAN1.CalculateTimeBit=1000
|
||||
CAN1.CalculateTimeQuantum=200.0
|
||||
CAN1.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,BS1,Prescaler
|
||||
CAN1.Prescaler=16
|
||||
@ -208,7 +208,7 @@ ProjectManager.FreePins=false
|
||||
ProjectManager.HalAssertFull=false
|
||||
ProjectManager.HeapSize=0x200
|
||||
ProjectManager.KeepUserCode=true
|
||||
ProjectManager.LastFirmware=false
|
||||
ProjectManager.LastFirmware=true
|
||||
ProjectManager.LibraryCopy=1
|
||||
ProjectManager.MainLocation=Core/Src
|
||||
ProjectManager.NoMain=false
|
||||
@ -291,4 +291,3 @@ VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
board=custom
|
||||
isbadioc=false
|
||||
|
77
STM32-for-VSCode.config.yaml
Normal file
77
STM32-for-VSCode.config.yaml
Normal file
@ -0,0 +1,77 @@
|
||||
# Configuration file for the STM32 for VSCode extension
|
||||
# Arrays can be inputted in two ways. One is: [entry_1, entry_2, ..., entry_final]
|
||||
# or by adding an indented list below the variable name e.g.:
|
||||
# VARIABLE:
|
||||
# - entry_1
|
||||
# - entry_2
|
||||
|
||||
# The project name
|
||||
target: TEC
|
||||
# Can be C or C++
|
||||
language: C
|
||||
|
||||
optimization: Og
|
||||
|
||||
# MCU settings
|
||||
targetMCU: STM32L432KBUx
|
||||
cpu:
|
||||
fpu:
|
||||
floatAbi:
|
||||
ldscript: STM32L432KBUX_FLASH.ld # linker script
|
||||
|
||||
# Compiler definitions. The -D prefix for the compiler will be automatically added.
|
||||
cDefinitions: []
|
||||
cxxDefinitions: []
|
||||
asDefinitions: []
|
||||
|
||||
# Compiler definition files. you can add a single files or an array of files for different definitions.
|
||||
# The file is expected to have a definition each new line.
|
||||
# This allows to include for example a .definition file which can be ignored in git and can contain
|
||||
# This can be convenient for passing along secrets at compile time, or generating a file for per device setup.
|
||||
cDefinitionsFile:
|
||||
cxxDefinitionsFile:
|
||||
asDefinitionsFile:
|
||||
|
||||
# Compiler flags
|
||||
cFlags: []
|
||||
cxxFlags: []
|
||||
assemblyFlags:
|
||||
- -specs=nosys.specs
|
||||
|
||||
|
||||
# libraries to be included. The -l prefix to the library will be automatically added.
|
||||
# Mind that non standard libraries should have a path to their respective directory.
|
||||
libraries: []
|
||||
libraryDirectories: []
|
||||
|
||||
# Files or folders that will be excluded from compilation.
|
||||
# Glob patterns (https://www.wikiwand.com/en/Glob_(programming)) can be used.
|
||||
# Do mind that double stars are reserved in yaml
|
||||
# these should be escaped with a: \ or the name should be in double quotes e.g. "**.test.**"
|
||||
excludes:
|
||||
- "**_Template.*"
|
||||
|
||||
|
||||
# Include directories (directories containing .h or .hpp files)
|
||||
# If a CubeMX makefile is present it will automatically include the include directories from that makefile.
|
||||
includeDirectories:
|
||||
- Core/Inc/**
|
||||
- Middlewares/**
|
||||
- Drivers/STM32L4xx_HAL_Driver/Inc/**
|
||||
- Drivers/CMSIS/**
|
||||
|
||||
|
||||
# Files that should be included in the compilation.
|
||||
# If a CubeMX makefile is present it will automatically include the c and cpp/cxx files from that makefile.
|
||||
# Glob patterns (https://www.wikiwand.com/en/Glob_(programming)) can be used.
|
||||
# Do mind that double stars are reserved in yaml
|
||||
# these should be escaped with a: \ or the name should be in double quotes e.g. "HARDWARE_DRIVER*.c"
|
||||
sourceFiles:
|
||||
- Core/Src/**
|
||||
- Drivers/STM32L4xx_HAL_Driver/Src/**
|
||||
|
||||
|
||||
# When no makefile is present it will show a warning pop-up.
|
||||
# However when compilation without the CubeMX Makefile is desired, this can be turned of.
|
||||
suppressMakefileWarning: false
|
||||
|
239
STM32Make.make
Normal file
239
STM32Make.make
Normal file
@ -0,0 +1,239 @@
|
||||
##########################################################################################################################
|
||||
# File automatically-generated by STM32forVSCode
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
# Generic Makefile (based on gcc)
|
||||
#
|
||||
# ChangeLog :
|
||||
# 2017-02-10 - Several enhancements + project update mode
|
||||
# 2015-07-22 - first version
|
||||
# ------------------------------------------------
|
||||
|
||||
######################################
|
||||
# target
|
||||
######################################
|
||||
TARGET = TEC
|
||||
|
||||
|
||||
######################################
|
||||
# building variables
|
||||
######################################
|
||||
# debug build?
|
||||
DEBUG = 1
|
||||
# optimization
|
||||
OPT = -Og
|
||||
|
||||
|
||||
#######################################
|
||||
# paths
|
||||
#######################################
|
||||
# Build path
|
||||
BUILD_DIR = build
|
||||
|
||||
######################################
|
||||
# source
|
||||
######################################
|
||||
# C sources
|
||||
C_SOURCES = \
|
||||
Core/Src/freertos.c \
|
||||
Core/Src/main.c \
|
||||
Core/Src/stm32l4xx_hal_msp.c \
|
||||
Core/Src/stm32l4xx_it.c \
|
||||
Core/Src/syscalls.c \
|
||||
Core/Src/sysmem.c \
|
||||
Core/Src/system_stm32l4xx.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_adc_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_can.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dac_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \
|
||||
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c
|
||||
|
||||
|
||||
CPP_SOURCES = \
|
||||
|
||||
|
||||
# ASM sources
|
||||
ASM_SOURCES = \
|
||||
|
||||
|
||||
|
||||
#######################################
|
||||
# binaries
|
||||
#######################################
|
||||
PREFIX = arm-none-eabi-
|
||||
POSTFIX = "
|
||||
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
|
||||
# either it can be added to the PATH environment variable.
|
||||
GCC_PATH="/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.3.1/.content/bin
|
||||
ifdef GCC_PATH
|
||||
CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX)
|
||||
CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX)
|
||||
AS = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX) -x assembler-with-cpp
|
||||
CP = $(GCC_PATH)/$(PREFIX)objcopy$(POSTFIX)
|
||||
SZ = $(GCC_PATH)/$(PREFIX)size$(POSTFIX)
|
||||
else
|
||||
CXX = $(PREFIX)g++
|
||||
CC = $(PREFIX)gcc
|
||||
AS = $(PREFIX)gcc -x assembler-with-cpp
|
||||
CP = $(PREFIX)objcopy
|
||||
SZ = $(PREFIX)size
|
||||
endif
|
||||
HEX = $(CP) -O ihex
|
||||
BIN = $(CP) -O binary -S
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
#######################################
|
||||
# cpu
|
||||
CPU =
|
||||
|
||||
# fpu
|
||||
FPU =
|
||||
|
||||
# float-abi
|
||||
FLOAT-ABI =
|
||||
|
||||
# mcu
|
||||
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
||||
|
||||
# macros for gcc
|
||||
# AS defines
|
||||
AS_DEFS =
|
||||
|
||||
# C defines
|
||||
C_DEFS = \
|
||||
|
||||
|
||||
# AS includes
|
||||
AS_INCLUDES = \
|
||||
|
||||
# C includes
|
||||
C_INCLUDES = \
|
||||
-ICore/Inc \
|
||||
-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \
|
||||
-IDrivers/CMSIS/Include \
|
||||
-IDrivers/STM32L4xx_HAL_Driver/Inc \
|
||||
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \
|
||||
-IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 \
|
||||
-IMiddlewares/Third_Party/FreeRTOS/Source/include \
|
||||
-IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F
|
||||
|
||||
|
||||
|
||||
# compile gcc flags
|
||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -g -gdwarf-2
|
||||
endif
|
||||
|
||||
# Add additional flags
|
||||
CFLAGS +=
|
||||
ASFLAGS += -specs=nosys.specs
|
||||
CXXFLAGS =
|
||||
CXXFLAGS += -feliminate-unused-debug-types
|
||||
|
||||
# Generate dependency information
|
||||
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
||||
|
||||
#######################################
|
||||
# LDFLAGS
|
||||
#######################################
|
||||
# link script
|
||||
LDSCRIPT = STM32L432KBUX_FLASH.ld
|
||||
|
||||
# libraries
|
||||
LIBS =
|
||||
LIBDIR = \
|
||||
|
||||
|
||||
# Additional LD Flags from config file
|
||||
ADDITIONALLDFLAGS = -specs=nosys.specs
|
||||
|
||||
LDFLAGS = $(MCU) $(ADDITIONALLDFLAGS) -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
||||
|
||||
# default action: build all
|
||||
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
||||
|
||||
|
||||
#######################################
|
||||
# build the application
|
||||
#######################################
|
||||
# list of cpp program objects
|
||||
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
|
||||
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
|
||||
# list of C objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
||||
# list of ASM program objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp STM32Make.make | $(BUILD_DIR)
|
||||
$(CXX) -c $(CXXFLAGS) $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.cpp=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c STM32Make.make | $(BUILD_DIR)
|
||||
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s STM32Make.make | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) STM32Make.make
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(SZ) $@
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(HEX) $< $@
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(BIN) $< $@
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $@
|
||||
|
||||
#######################################
|
||||
# flash
|
||||
#######################################
|
||||
flash: $(BUILD_DIR)/$(TARGET).elf
|
||||
"/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-2.1/.content/bin/openocd" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
|
||||
|
||||
#######################################
|
||||
# erase
|
||||
#######################################
|
||||
erase: $(BUILD_DIR)/$(TARGET).elf
|
||||
"/Users/noahpique/Library/Application Support/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-2.1/.content/bin/openocd" -f ./openocd.cfg -c "init; reset halt; STM32L432KBUx mass_erase 0; exit"
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
-rm -fR $(BUILD_DIR)
|
||||
|
||||
#######################################
|
||||
# dependencies
|
||||
#######################################
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
||||
# *** EOF ***
|
8
openocd.cfg
Normal file
8
openocd.cfg
Normal file
@ -0,0 +1,8 @@
|
||||
#OpenOCD configuration file, generated by STM32 for VSCode
|
||||
|
||||
# Programmer, can be changed to several interfaces
|
||||
# Standard will be the stlink interface as this is the standard for STM32 dev boards
|
||||
source [find interface/stlink.cfg]
|
||||
|
||||
# The target MCU. This should match your board
|
||||
source [find target/.cfg]
|
Reference in New Issue
Block a user