Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obtain HSE_VALUE from config.h where provided. #12632

Merged
merged 1 commit into from Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions Makefile
Expand Up @@ -93,9 +93,6 @@ include $(ROOT)/make/$(OSFAMILY).mk
# include the tools makefile
include $(ROOT)/make/tools.mk

# default xtal value for F4 targets
HSE_VALUE ?= 8000000

# Search path for sources
VPATH := $(SRC_DIR):$(SRC_DIR)/startup
FATFS_DIR = $(ROOT)/lib/main/FatFS
Expand All @@ -115,7 +112,11 @@ ifeq ($(wildcard $(CONFIG_FILE)),)
$(error Config file not found: $(CONFIG_FILE))
endif

TARGET := $(shell grep " FC_TARGET_MCU" $(CONFIG_FILE) | awk '{print $$3}' )
TARGET := $(shell grep " FC_TARGET_MCU" $(CONFIG_FILE) | awk '{print $$3}' )
HSE_VALUE_MHZ := $(shell grep " SYSTEM_HSE_MHZ" $(CONFIG_FILE) | awk '{print $$3}' )
ifneq ($(HSE_VALUE_MHZ),)
HSE_VALUE := $(shell echo $$(( $(HSE_VALUE_MHZ) * 1000000 )) )
endif

ifeq ($(TARGET),)
$(error No TARGET identified. Is the config.h valid for $(CONFIG)?)
Expand All @@ -132,6 +133,9 @@ TARGET := $(DEFAULT_TARGET)
endif
endif #CONFIG

# default xtal value
HSE_VALUE ?= 8000000

BASE_CONFIGS = $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(ROOT)/src/config/*/config.h)))))
BASE_TARGETS = $(sort $(notdir $(patsubst %/,%,$(dir $(wildcard $(ROOT)/src/main/target/*/target.mk)))))
CI_TARGETS := $(BASE_TARGETS) CRAZYBEEF4SX1280 CRAZYBEEF4FR IFLIGHT_BLITZ_F722
Expand Down
4 changes: 0 additions & 4 deletions src/main/platform.h
Expand Up @@ -32,10 +32,6 @@
#include "config.h"
#endif

#if defined(SYSTEM_HSE_MHZ) && !defined(HSE_VALUE)
#define HSE_VALUE (SYSTEM_HSE_MHZ * 1000000)
#endif

// MCU specific platform from drivers/XX
#include "platform_mcu.h"

Expand Down