Blink f1 (#50)

* Fix target_f1 build

* restore build for F1 target

* change default LED pin state

* add real hw gif

Co-authored-by: Vadim Kaushan <admin@disasm.info>
This commit is contained in:
coreglitch
2020-08-26 14:43:18 +06:00
committed by GitHub
parent e7aa6caf0e
commit ab07bfb104
12 changed files with 134 additions and 62 deletions

View File

@@ -1,7 +1,7 @@
[PreviousGenFiles]
HeaderPath=/home/aanper/project/flipperzero/fw/target_prod/Inc
HeaderPath=/home/aanper/project/flipperzero/flipperzero-firmware-community/target_f1/Inc
HeaderFiles=FreeRTOSConfig.h;stm32l4xx_it.h;stm32l4xx_hal_conf.h;main.h;usb_device.h;usbd_conf.h;usbd_desc.h;usbd_cdc_if.h;
SourcePath=/home/aanper/project/flipperzero/fw/target_prod/Src
SourcePath=/home/aanper/project/flipperzero/flipperzero-firmware-community/target_f1/Src
SourceFiles=freertos.c;stm32l4xx_it.c;stm32l4xx_hal_msp.c;main.c;usb_device.c;usbd_conf.c;usbd_desc.c;usbd_cdc_if.c;
[PreviousLibFiles]

View File

@@ -97,4 +97,4 @@ inline void app_tim_pulse(uint32_t width) {
inline void app_tim_stop() {
HAL_TIM_OC_Stop(&htim8, TIM_CHANNEL_2);
HAL_TIM_IC_Stop(&htim8, TIM_CHANNEL_2);
}
}

View File

@@ -34,8 +34,14 @@ BUILD_DIR = build
######################################
# source
######################################
# C sources
C_SOURCES = \
C_SOURCES =
CPP_SOURCES =
ASM_SOURCES =
C_DEFS =
# Target
C_SOURCES += \
Src/main.c \
Src/freertos.c \
Src/stm32l4xx_it.c \
@@ -89,14 +95,44 @@ Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c
# ASM sources
ASM_SOURCES = \
C_SOURCES += Src/flipper_hal.c
C_DEFS += \
-DUSE_HAL_DRIVER \
-DSTM32L476xx \
-DBUTON_INVERT=false \
-DDEBUG_UART=huart1
ASM_SOURCES += \
startup_stm32l476xx.s
CPP_SOURCES = ../app/app.cpp
# Core
C_SOURCES += ../app/write.c
C_SOURCES += Src/flipper_hal.c
CPP_SOURCES += ../core/app.cpp
C_SOURCES += ../core/debug.c
C_SOURCES += ../core/furi.c
C_SOURCES += ../core/furi_ac.c
# System applications
ifeq ($(TEST), 1)
C_SOURCES += ../applications/tests/furiac_test.c
C_SOURCES += ../applications/tests/furi_record_test.c
C_SOURCES += ../applications/tests/test_index.c
C_DEFS += -DTEST
endif
# Examples
ifeq ($(EXAMPLE_BLINK), 1)
C_SOURCES += ../applications/examples/blink.c
C_DEFS += -DEXAMPLE_BLINK
endif
# User application
# Add C_SOURCES +=, C_DEFS += or CPP_SOURCES += here
#######################################
# binaries
@@ -139,13 +175,6 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# AS defines
AS_DEFS =
# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32L476xx \
-DBUTON_INVERT=false \
-DDEBUG_UART=huart1
# AS includes
AS_INCLUDES = \
@@ -196,6 +225,11 @@ LDFLAGS = $(MCU) -specs=nano.specs -specs=nosys.specs -T$(LDSCRIPT) $(LIBDIR) $(
# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
example_blink:
EXAMPLE_BLINK=1 make
test:
TEST=1 make
#######################################
# build the application

View File

@@ -53,6 +53,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*---------------------------------------------------------------------------*/
#include <stdbool.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
@@ -1019,6 +1021,9 @@ osStatus osRecursiveMutexWait (osMutexId mutex_id, uint32_t millisec);
*/
uint32_t osSemaphoreGetCount(osSemaphoreId semaphore_id);
// FreeRTOS add-on
bool task_equal(TaskHandle_t a, TaskHandle_t b);
#ifdef __cplusplus
}
#endif

View File

@@ -25,6 +25,7 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdbool.h>
/* USER CODE END Includes */
@@ -105,6 +106,11 @@ void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, Stack
/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */
bool task_equal(TaskHandle_t a, TaskHandle_t b) {
if(a == NULL || b == NULL) return false;
return a == b;
}
/* USER CODE END Application */

View File

@@ -680,15 +680,20 @@ static void MX_GPIO_Init(void)
__HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, DISPLAY_DI_Pin|LED_RED_Pin|CC1101_CS_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, DISPLAY_DI_Pin|CC1101_CS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, LED_BLUE_Pin|DISPLAY_RST_Pin|IR_TX_Pin|LED_GREEN_Pin
|DISPLAY_BACKLIGHT_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, LED_BLUE_Pin|LED_GREEN_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, DISPLAY_RST_Pin|IR_TX_Pin|DISPLAY_BACKLIGHT_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, VIBRO_Pin|DISPLAY_CS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LED_RED_GPIO_Port, LED_RED_Pin, GPIO_PIN_SET);
/*Configure GPIO pins : PC13 PC0 PC1 PC9 */
GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
@@ -757,7 +762,7 @@ static void MX_GPIO_Init(void)
GPIO_InitStruct.Pin = LED_RED_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(LED_RED_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PD2 */

View File

@@ -170,11 +170,12 @@ PA6.Locked=true
PA6.Signal=GPXTI6
PA7.Locked=true
PA7.Signal=GPIO_Analog
PA8.GPIOParameters=GPIO_Speed,GPIO_Label,GPIO_ModeDefaultOutputPP
PA8.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP
PA8.GPIO_Label=LED_RED
PA8.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD
PA8.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PA8.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
PA8.Locked=true
PA8.PinState=GPIO_PIN_SET
PA8.Signal=GPIO_Output
PA9.Locked=true
PA9.Mode=Asynchronous
@@ -185,11 +186,12 @@ PB0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING
PB0.GPIO_PuPd=GPIO_PULLDOWN
PB0.Locked=true
PB0.Signal=GPXTI0
PB1.GPIOParameters=GPIO_Speed,GPIO_Label,GPIO_ModeDefaultOutputPP
PB1.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP
PB1.GPIO_Label=LED_BLUE
PB1.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD
PB1.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
PB1.Locked=true
PB1.PinState=GPIO_PIN_SET
PB1.Signal=GPIO_Output
PB10.GPIOParameters=GPIO_Label
PB10.GPIO_Label=DISPLAY_RST
@@ -206,11 +208,12 @@ PB13.GPIO_Label=RFID_OUT
PB13.Locked=true
PB13.Mode=Output Compare1 CH1N
PB13.Signal=TIM15_CH1N
PB14.GPIOParameters=GPIO_Speed,GPIO_Label,GPIO_ModeDefaultOutputPP
PB14.GPIOParameters=GPIO_Speed,PinState,GPIO_Label,GPIO_ModeDefaultOutputPP
PB14.GPIO_Label=LED_GREEN
PB14.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD
PB14.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
PB14.Locked=true
PB14.PinState=GPIO_PIN_SET
PB14.Signal=GPIO_Output
PB15.GPIOParameters=GPIO_Label
PB15.GPIO_Label=RFID_PULL
@@ -339,8 +342,8 @@ ProjectManager.MainLocation=Src
ProjectManager.NoMain=false
ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=flipperzero_l476.ioc
ProjectManager.ProjectName=flipperzero_l476
ProjectManager.ProjectFileName=flipperzero_f1.ioc
ProjectManager.ProjectName=flipperzero_f1
ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=Makefile
ProjectManager.ToolChainLocation=