mirror of
https://github.com/espressif/esp-drone.git
synced 2026-07-21 10:15:36 +00:00
Merge branch 'fix/support_idf4.4_and_esp32s3' into 'master'
fix: support idf>=4.4 and esp32s3 See merge request ae_group/esp-college/esp-drone!32
This commit is contained in:
+29
-2
@@ -5,10 +5,37 @@ stages:
|
||||
variables:
|
||||
BATCH_BUILD: "1"
|
||||
V: "0"
|
||||
MAKEFLAGS: "-j5 --no-keep-going"
|
||||
IDF_PATH: "$CI_PROJECT_DIR/esp-idf"
|
||||
IDF_CI_BUILD: "1"
|
||||
|
||||
before_script:
|
||||
# add gitlab ssh key
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
|
||||
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||
- git --version
|
||||
- git submodule update --init --recursive --force
|
||||
|
||||
.build_examples_template: &build_examples_template
|
||||
stage: build
|
||||
image: espressif/idf:release-v4.4
|
||||
tags:
|
||||
- build
|
||||
|
||||
build_demo_cmake:
|
||||
<<: *build_examples_template
|
||||
script:
|
||||
- idf.py fullclean
|
||||
- idf.py build
|
||||
- idf.py fullclean
|
||||
- idf.py set-target esp32s2
|
||||
- idf.py build
|
||||
- idf.py fullclean
|
||||
- idf.py set-target esp32s3
|
||||
- idf.py build
|
||||
|
||||
build_docs:
|
||||
stage: build
|
||||
image: $CI_SPHINX_DOCKER:latest
|
||||
|
||||
+1
-2
@@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(__PROJECT_GROUP_LINK_COMPONENTS ON)
|
||||
|
||||
set(PLANE_COMPONENT_DIRS ${PLANE_COMPONENT_DIRS}
|
||||
"./components/core"
|
||||
set(PLANE_COMPONENT_DIRS "./components/core"
|
||||
"./components/drivers"
|
||||
"./components/drivers/general"
|
||||
"./components/drivers/i2c_devices"
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
|
||||
### Introduction
|
||||
|
||||
**ESP-Drone** is an open source solution based on Espressif ESP32/ESP32-S2 Wi-Fi chip, which can be controlled by a mobile APP or gamepad over **Wi-Fi** connection. ESP-Drone comes with **simple hardware**, **clear and extensible code architecture**, and therefore this project can be used in **STEAM education** and other fields. The main code is ported from **Crazyflie** open source project with **GPL3.0** protocol.
|
||||
**ESP-Drone** is an open source solution based on Espressif ESP32/ESP32-S2/S3 Wi-Fi chip, which can be controlled by a mobile APP or gamepad over **Wi-Fi** connection. ESP-Drone comes with **simple hardware**, **clear and extensible code architecture**, and therefore this project can be used in **STEAM education** and other fields. The main code is ported from **Crazyflie** open source project with **GPL3.0** protocol.
|
||||
|
||||
> Currently support ESP32、ESP32S2、ESP32S3, please using ESP-IDF [release/v4.4](https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html) branch as your develop environment
|
||||
|
||||

|
||||
|
||||
|
||||
+3
-1
@@ -5,7 +5,9 @@
|
||||
|
||||
### 简介
|
||||
|
||||
ESP-Drone 是基于乐鑫 ESP32-S2/ESP32 开发的小型无人机解决方案,可使用手机 APP 或游戏手柄通过 Wi-Fi 网络进行连接和控制。目前已支持自稳定飞行、定高飞行、定点飞行等多种模式。该方案硬件结构简单,代码架构清晰完善,方便功能扩展,可用于 STEAM 教育等领域。控制系统代码来自 Crazyflie 开源工程,使用 GPL3.0 开源协议。
|
||||
ESP-Drone 是基于乐鑫 ESP32/ESP32-S2/S3 开发的小型无人机解决方案,可使用手机 APP 或游戏手柄通过 Wi-Fi 网络进行连接和控制。目前已支持自稳定飞行、定高飞行、定点飞行等多种模式。该方案硬件结构简单,代码架构清晰完善,方便功能扩展,可用于 STEAM 教育等领域。控制系统代码来自 Crazyflie 开源工程,使用 GPL3.0 开源协议。
|
||||
|
||||
> 目前已支持 ESP32、ESP32S2、ESP32S3, 请使用 ESP-IDF [release/v4.4](https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html) 分支
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -47,11 +47,17 @@
|
||||
#define QUAD_FORMATION_X
|
||||
|
||||
#ifdef CONFIG_TARGET_ESPLANE_V2_S2
|
||||
#define TARGET_MCU_ESP32S2
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32S2
|
||||
#error "ESPLANE_V2 hardware with ESP32S2 onboard"
|
||||
#endif
|
||||
#elif defined(CONFIG_TARGET_ESPLANE_V1)
|
||||
#define TARGET_MCU_ESP32
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32
|
||||
#error "ESPLANE_V1 hardware with ESP32 onboard"
|
||||
#endif
|
||||
#elif defined(CONFIG_TARGET_ESP32_S2_DRONE_V1_2)
|
||||
#define TARGET_MCU_ESP32S2
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#error "ESP32_S2_DRONE_V1_2 hardware with ESP32S2/S3 onboard"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef STM32F4XX
|
||||
@@ -147,10 +153,10 @@
|
||||
#define ESKYLINK_TASK_NAME "ESKYLINK"
|
||||
#define SYSLINK_TASK_NAME "SYSLINK"
|
||||
#define USBLINK_TASK_NAME "USBLINK"
|
||||
#define WIFILINK_TASK_NAME "WIFILINK"
|
||||
#define UDP_TX_TASK_NAME "UDP_TX"
|
||||
#define UDP_RX_TASK_NAME "UDP_RX"
|
||||
#define UDP_RX2_TASK_NAME "UDP_RX2"
|
||||
#define WIFILINK_TASK_NAME "WIFILINK"
|
||||
#define UDP_TX_TASK_NAME "UDP_TX"
|
||||
#define UDP_RX_TASK_NAME "UDP_RX"
|
||||
#define UDP_RX2_TASK_NAME "UDP_RX2"
|
||||
#define PROXIMITY_TASK_NAME "PROXIMITY"
|
||||
#define EXTRX_TASK_NAME "EXTRX"
|
||||
#define UART_RX_TASK_NAME "UART"
|
||||
@@ -194,7 +200,7 @@
|
||||
#define ESKYLINK_TASK_STACKSIZE (1 * configBASE_STACK_SIZE)
|
||||
#define SYSLINK_TASK_STACKSIZE (1 * configBASE_STACK_SIZE)
|
||||
#define USBLINK_TASK_STACKSIZE (1 * configBASE_STACK_SIZE)
|
||||
#define WIFILINK_TASK_STACKSIZE (5 * configBASE_STACK_SIZE)
|
||||
#define WIFILINK_TASK_STACKSIZE (6 * configBASE_STACK_SIZE)
|
||||
#define UDP_TX_TASK_STACKSIZE (2 * configBASE_STACK_SIZE)
|
||||
#define UDP_RX_TASK_STACKSIZE (4 * configBASE_STACK_SIZE)
|
||||
#define UDP_RX2_TASK_STACKSIZE (1 * configBASE_STACK_SIZE)
|
||||
|
||||
@@ -68,9 +68,14 @@ idf_component_register(SRCS "./hal/src/buzzer.c"
|
||||
"./utils/src/version.c"
|
||||
"./utils/src/rateSupervisor.c"
|
||||
INCLUDE_DIRS "./hal/interface" "./modules/interface" "./utils/interface"
|
||||
REQUIRES i2c_bus deck mpu6050 ms5611 hmc5883l pmw3901 vl53l1 vl53l0 platform config led eeprom dsp_lib motors wifi adc)
|
||||
REQUIRES i2c_bus deck mpu6050 ms5611 hmc5883l pmw3901 vl53l1 vl53l0 platform config led eeprom dsp_lib motors wifi adc esp_timer)
|
||||
|
||||
idf_component_get_property( FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
|
||||
target_include_directories(${COMPONENT_TARGET} PUBLIC
|
||||
"${FREERTOS_ORIG_INCLUDE_PATH}"
|
||||
)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-strict-aliasing"
|
||||
"-Wno-error=stringop-truncation"
|
||||
"-Wno-absolute-value"
|
||||
"-Wno-address-of-packed-member"
|
||||
"-Wno-stringop-truncation")
|
||||
@@ -28,8 +28,9 @@
|
||||
#ifndef PM_H_
|
||||
#define PM_H_
|
||||
|
||||
#include "driver/adc.h"
|
||||
#include "esp_idf_version.h"
|
||||
#include "syslink.h"
|
||||
#include "driver/adc.h"
|
||||
//#include "deck.h"
|
||||
|
||||
#ifndef CRITICAL_LOW_VOLTAGE
|
||||
|
||||
@@ -140,9 +140,7 @@ static xQueueHandle barometerDataQueue;
|
||||
STATIC_MEM_QUEUE_ALLOC(barometerDataQueue, 1, sizeof(baro_t));
|
||||
|
||||
static xSemaphoreHandle sensorsDataReady;
|
||||
static StaticSemaphore_t sensorsDataReadyBuffer;
|
||||
static xSemaphoreHandle dataReady;
|
||||
static StaticSemaphore_t dataReadyBuffer;
|
||||
|
||||
static bool isInit = false;
|
||||
static sensorData_t sensorData;
|
||||
@@ -168,15 +166,22 @@ static void applyAxis3fLpf(lpf2pData *data, Axis3f *in);
|
||||
|
||||
static bool isBarometerPresent = false;
|
||||
static bool isMagnetometerPresent = false;
|
||||
#ifdef SENSORS_ENABLE_RANGE_VL53L1X
|
||||
static bool isVl53l1xPresent = false;
|
||||
#endif
|
||||
#ifdef SENSORS_ENABLE_RANGE_VL53L0X
|
||||
static bool isVl53l0xPresent = false;
|
||||
#endif
|
||||
#ifdef SENSORS_ENABLE_FLOW_PMW3901
|
||||
static bool isPmw3901Present = false;
|
||||
|
||||
#endif
|
||||
static bool isMpu6050TestPassed = false;
|
||||
#ifdef SENSORS_ENABLE_MAG_HM5883L
|
||||
static bool isHmc5883lTestPassed = false;
|
||||
#endif
|
||||
#ifdef SENSORS_ENABLE_PRESSURE_MS5611
|
||||
static bool isMs5611TestPassed = false;
|
||||
static bool isVl53l1xTestPassed = false;
|
||||
static bool isPmw3901TestPassed = false;
|
||||
#endif
|
||||
|
||||
// Pre-calculated values for accelerometer alignment
|
||||
float cosPitch;
|
||||
@@ -409,7 +414,9 @@ static void sensorsDeviceInit(void)
|
||||
if (mpu6050TestConnection() == true) {
|
||||
DEBUG_PRINTI("MPU6050 I2C connection [OK].\n");
|
||||
} else {
|
||||
DEBUG_PRINTW("MPU6050 I2C connection [FAIL].\n");
|
||||
DEBUG_PRINTE("MPU6050 I2C connection [FAIL].\n");
|
||||
// Please check your hardware !
|
||||
assert(0);
|
||||
}
|
||||
|
||||
mpu6050Reset();
|
||||
@@ -514,7 +521,6 @@ static void sensorsDeviceInit(void)
|
||||
#endif
|
||||
|
||||
#ifdef SENSORS_ENABLE_FLOW_PMW3901
|
||||
|
||||
flowdeck2Init();
|
||||
|
||||
if (flowdeck2Test() == true) {
|
||||
@@ -525,9 +531,6 @@ static void sensorsDeviceInit(void)
|
||||
//TODO: Should sensor test fail hard if no connection
|
||||
DEBUG_PRINTW("PMW3901 SPI connection [FAIL].\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
DEBUG_PRINTI("sensors init done");
|
||||
@@ -635,17 +638,22 @@ static void sensorsInterruptInit(void)
|
||||
{
|
||||
|
||||
DEBUG_PRINTD("sensorsInterruptInit \n");
|
||||
gpio_config_t io_conf;
|
||||
//interrupt of rising edge
|
||||
io_conf.intr_type = GPIO_PIN_INTR_POSEDGE;
|
||||
//bit mask of the pins
|
||||
io_conf.pin_bit_mask = (1ULL << GPIO_INTA_MPU6050_IO);
|
||||
//set as input mode
|
||||
io_conf.mode = GPIO_MODE_INPUT;
|
||||
//disable pull-down mode
|
||||
io_conf.pull_down_en = 0;
|
||||
//enable pull-up mode
|
||||
io_conf.pull_up_en = 1;
|
||||
gpio_config_t io_conf = {
|
||||
//interrupt of rising edge
|
||||
#if ESP_IDF_VERSION_MAJOR > 4
|
||||
.intr_type = GPIO_INTR_POSEDGE,
|
||||
#else
|
||||
.intr_type = GPIO_PIN_INTR_POSEDGE,
|
||||
#endif
|
||||
//bit mask of the pins
|
||||
.pin_bit_mask = (1ULL << GPIO_INTA_MPU6050_IO),
|
||||
//set as input mode
|
||||
.mode = GPIO_MODE_INPUT,
|
||||
//disable pull-down mode
|
||||
.pull_down_en = 0,
|
||||
//enable pull-up mode
|
||||
.pull_up_en = 1,
|
||||
};
|
||||
sensorsDataReady = xSemaphoreCreateBinary();
|
||||
dataReady = xSemaphoreCreateBinary();
|
||||
gpio_config(&io_conf);
|
||||
@@ -1047,5 +1055,6 @@ PARAM_GROUP_STOP(imu_sensors)
|
||||
PARAM_GROUP_START(imu_tests)
|
||||
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, mpu6050, &isMpu6050TestPassed)
|
||||
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, HMC5883L, &isMagnetometerPresent)
|
||||
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, pmw3901, &isPmw3901Present)
|
||||
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, MS5611, &isBarometerPresent) // TODO: Rename MS5611 to LPS25H. Client needs to be updated at the same time.
|
||||
PARAM_GROUP_STOP(imu_tests)
|
||||
|
||||
@@ -63,9 +63,6 @@ static int wifilinkReceiveCRTPPacket(CRTPPacket *p);
|
||||
|
||||
STATIC_MEM_TASK_ALLOC(wifilinkTask, USBLINK_TASK_STACKSIZE);
|
||||
|
||||
static float rch, pch, ych;
|
||||
static uint16_t tch;
|
||||
|
||||
static bool wifilinkIsConnected(void)
|
||||
{
|
||||
return (xTaskGetTickCount() - lastPacketTick) < M2T(WIFI_ACTIVITY_TIMEOUT_MS);
|
||||
@@ -78,6 +75,7 @@ static struct crtpLinkOperations wifilinkOp = {
|
||||
.isConnected = wifilinkIsConnected,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ENABLE_LEGACY_APP
|
||||
static bool detectOldVersionApp(UDPPacket *in)
|
||||
{
|
||||
|
||||
@@ -89,6 +87,7 @@ static bool detectOldVersionApp(UDPPacket *in)
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void wifilinkTask(void *param)
|
||||
{
|
||||
@@ -97,7 +96,8 @@ static void wifilinkTask(void *param)
|
||||
wifiGetDataBlocking(&wifiIn);
|
||||
lastPacketTick = xTaskGetTickCount();
|
||||
#ifdef CONFIG_ENABLE_LEGACY_APP
|
||||
|
||||
float rch, pch, ych;
|
||||
uint16_t tch;
|
||||
if (detectOldVersionApp(&wifiIn)) {
|
||||
rch = (1.0) * (float)(((((uint16_t)wifiIn.data[1] << 8) + (uint16_t)wifiIn.data[2]) - 296) * 15.0 / 150.0); //-15~+15
|
||||
pch = (-1.0) * (float)(((((uint16_t)wifiIn.data[3] << 8) + (uint16_t)wifiIn.data[4]) - 296) * 15.0 / 150.0); //-15~+15
|
||||
|
||||
@@ -109,10 +109,11 @@ static StaticSemaphore_t lockTrajBuffer;
|
||||
static float defaultTakeoffVelocity = 0.5f;
|
||||
static float defaultLandingVelocity = 0.5f;
|
||||
|
||||
// TODO
|
||||
// Trajectory memory handling from the memory module
|
||||
static uint32_t handleMemGetSize(void) { return crtpCommanderHighLevelTrajectoryMemSize(); }
|
||||
static bool handleMemRead(const uint32_t memAddr, const uint8_t readLen, uint8_t* buffer);
|
||||
static bool handleMemWrite(const uint32_t memAddr, const uint8_t writeLen, const uint8_t* buffer);
|
||||
// static uint32_t handleMemGetSize(void) { return crtpCommanderHighLevelTrajectoryMemSize(); }
|
||||
// static bool handleMemRead(const uint32_t memAddr, const uint8_t readLen, uint8_t* buffer);
|
||||
// static bool handleMemWrite(const uint32_t memAddr, const uint8_t writeLen, const uint8_t* buffer);
|
||||
// static const MemoryHandlerDef_t memDef = {
|
||||
// .type = MEM_TYPE_TRAJ,
|
||||
// .getSize = handleMemGetSize,
|
||||
@@ -628,13 +629,13 @@ int define_trajectory(const struct data_define_trajectory* data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool handleMemRead(const uint32_t memAddr, const uint8_t readLen, uint8_t* buffer) {
|
||||
return crtpCommanderHighLevelReadTrajectory(memAddr, readLen, buffer);
|
||||
}
|
||||
// static bool handleMemRead(const uint32_t memAddr, const uint8_t readLen, uint8_t* buffer) {
|
||||
// return crtpCommanderHighLevelReadTrajectory(memAddr, readLen, buffer);
|
||||
// }
|
||||
|
||||
static bool handleMemWrite(const uint32_t memAddr, const uint8_t writeLen, const uint8_t* buffer) {
|
||||
return crtpCommanderHighLevelWriteTrajectory(memAddr, writeLen, buffer);
|
||||
}
|
||||
// static bool handleMemWrite(const uint32_t memAddr, const uint8_t writeLen, const uint8_t* buffer) {
|
||||
// return crtpCommanderHighLevelWriteTrajectory(memAddr, writeLen, buffer);
|
||||
// }
|
||||
|
||||
uint8_t* initCrtpPacket(CRTPPacket* packet, const enum TrajectoryCommand_e command)
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ void setCommandermode(FlightMode mode){
|
||||
registerRequiredEstimator(complementaryEstimator);
|
||||
break;
|
||||
}
|
||||
DEBUG_PRINTI("FlightMode = %u",mode);
|
||||
DEBUG_PRINTI("FlightMode = %d",mode);
|
||||
#else
|
||||
DEBUG_PRINTI("set FlightMode disable");
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
* 2019.04.12, Kristoffer Richardsson: Refactored, separated kalman implementation from OS related functionality
|
||||
*
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "kalman_core.h"
|
||||
#include "estimator_kalman.h"
|
||||
#include "kalman_supervisor.h"
|
||||
@@ -332,7 +332,7 @@ static void kalmanTask(void* parameters) {
|
||||
nextPrediction = osTick + S2T(1.0f / PREDICT_RATE);
|
||||
|
||||
if (!rateSupervisorValidate(&rateSupervisorContext, T2M(osTick))) {
|
||||
DEBUG_PRINT("WARNING: Kalman prediction rate low (%u)\n", rateSupervisorLatestCount(&rateSupervisorContext));
|
||||
DEBUG_PRINT("WARNING: Kalman prediction rate low (%"PRIu32")\n", rateSupervisorLatestCount(&rateSupervisorContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ void logBlockTimed(xTimerHandle timer);
|
||||
|
||||
//These are set by the Linker
|
||||
extern struct log_s _log_start;
|
||||
extern struct log_s _log_stop;
|
||||
extern struct log_s _log_end;
|
||||
|
||||
//Pointer to the logeters list and length of it
|
||||
static struct log_s * logs;
|
||||
@@ -181,7 +181,7 @@ void logInit(void)
|
||||
return;
|
||||
|
||||
logs = &_log_start;
|
||||
logsLen = &_log_stop - &_log_start;
|
||||
logsLen = &_log_end - &_log_start;
|
||||
|
||||
// Calculate a hash of the toc by chaining description of each elements
|
||||
// Using the CRTP packet as temporary buffer
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
/* FreeRtos includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
@@ -341,7 +341,7 @@ static bool handleMemTesterWrite(const uint32_t memAddr, const uint8_t writeLen,
|
||||
if (actualData != expectedData) {
|
||||
// Log first error
|
||||
if (memTesterWriteErrorCount == 0) {
|
||||
DEBUG_PRINT("Verification failed: expected: %d, actual: %d, addr: %u\n", expectedData, actualData, addr);
|
||||
DEBUG_PRINT("Verification failed: expected: %d, actual: %d, addr: %"PRIu32"\n", expectedData, actualData, addr);
|
||||
}
|
||||
|
||||
memTesterWriteErrorCount++;
|
||||
|
||||
@@ -82,7 +82,7 @@ void paramTOCProcess(int command);
|
||||
|
||||
//These are set by the Linker
|
||||
extern struct param_s _param_start;
|
||||
extern struct param_s _param_stop;
|
||||
extern struct param_s _param_end;
|
||||
|
||||
//The following two function SHALL NOT be called outside paramTask!
|
||||
static void paramWriteProcess();
|
||||
@@ -115,7 +115,7 @@ void paramInit(void)
|
||||
return;
|
||||
|
||||
params = &_param_start;
|
||||
paramsLen = &_param_stop - &_param_start;
|
||||
paramsLen = &_param_end - &_param_start;
|
||||
|
||||
// Calculate a hash of the toc by chaining description of each elements
|
||||
// Using the CRTP packet as temporary buffer
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
@@ -322,7 +323,7 @@ static void stabilizerTask(void* param)
|
||||
|
||||
if (!rateSupervisorValidate(&rateSupervisorContext, xTaskGetTickCount())) {
|
||||
if (!rateWarningDisplayed) {
|
||||
DEBUG_PRINT("WARNING: stabilizer loop rate is off (%u)\n", rateSupervisorLatestCount(&rateSupervisorContext));
|
||||
DEBUG_PRINT("WARNING: stabilizer loop rate is off (%"PRIu32")\n", rateSupervisorLatestCount(&rateSupervisorContext));
|
||||
rateWarningDisplayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
#include "cfassert.h"
|
||||
@@ -101,20 +102,20 @@ static void timerHandler(xTimerHandle timer) {
|
||||
// CPU usage is since last dump in % compared to total time spent in tasks. Note that time spent in interrupts will be included in measured time.
|
||||
// Stack usage is displayed as nr of unused bytes at peak stack usage.
|
||||
|
||||
DEBUG_PRINTI("Task dump\n");
|
||||
DEBUG_PRINTI("Load\tStack left\tName\tPRI\n");
|
||||
DEBUG_PRINTI("Task dump");
|
||||
DEBUG_PRINTI("Load\tStack left\tName\tPRI");
|
||||
for (uint32_t i = 0; i < taskCount; i++) {
|
||||
TaskStatus_t* stats = &taskStats[i];
|
||||
taskData_t* previousTaskData = getPreviousTaskData(stats->xTaskNumber);
|
||||
|
||||
uint32_t taskRunTime = stats->ulRunTimeCounter;
|
||||
float load = f * (taskRunTime - previousTaskData->ulRunTimeCounter);
|
||||
DEBUG_PRINTI("%.2f \t%u \t%s \t%u\n", (double)load, stats->usStackHighWaterMark, stats->pcTaskName,stats->uxBasePriority);
|
||||
DEBUG_PRINTI("%.2f \t%"PRIu32" \t%s \t%d", (double)load, stats->usStackHighWaterMark, stats->pcTaskName,stats->uxBasePriority);
|
||||
|
||||
previousTaskData->ulRunTimeCounter = taskRunTime;
|
||||
}
|
||||
|
||||
DEBUG_PRINTI("Free heap: %d bytes\n", xPortGetFreeHeapSize());
|
||||
DEBUG_PRINTI("Free heap: %"PRIu32" bytes", xPortGetFreeHeapSize());
|
||||
previousTotalRunTime = totalRunTime;
|
||||
|
||||
triggerDump = 0;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
/* FreeRtos includes */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
@@ -264,7 +264,7 @@ void systemTask(void *arg)
|
||||
ledSet(SYS_LED, true);
|
||||
}
|
||||
}
|
||||
DEBUG_PRINT("Free heap: %d bytes\n", xPortGetFreeHeapSize());
|
||||
DEBUG_PRINT("Free heap: %"PRIu32" bytes\n", xPortGetFreeHeapSize());
|
||||
|
||||
workerLoop();
|
||||
|
||||
|
||||
@@ -26,25 +26,19 @@
|
||||
|
||||
void pinMode(uint32_t pin, uint32_t mode)
|
||||
{
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
if (pin > 35) {
|
||||
#elif defined(TARGET_MCU_ESP32S2)
|
||||
if (pin > 43) {
|
||||
#endif
|
||||
if (!GPIO_IS_VALID_GPIO((int)pin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gpio_config_t io_conf;
|
||||
//disable interrupt
|
||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||
io_conf.pin_bit_mask = (1ULL << pin);
|
||||
//disable pull-down mode
|
||||
io_conf.pull_down_en = 0;
|
||||
//disable pull-up mode
|
||||
io_conf.pull_up_en = 0;
|
||||
//configure GPIO with the given settings
|
||||
|
||||
gpio_config_t io_conf = {
|
||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||
.pin_bit_mask = (1ULL << pin),
|
||||
//disable pull-down mode
|
||||
.pull_down_en = 0,
|
||||
//disable pull-up mode
|
||||
.pull_up_en = 0,
|
||||
//configure GPIO with the given settings
|
||||
};
|
||||
//set as output mode
|
||||
if (mode == OUTPUT) {
|
||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||
@@ -65,11 +59,7 @@ void pinMode(uint32_t pin, uint32_t mode)
|
||||
|
||||
void digitalWrite(uint32_t pin, uint32_t val)
|
||||
{
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
if (pin > 35) {
|
||||
#elif defined(TARGET_MCU_ESP32S2)
|
||||
if (pin > 43) {
|
||||
#endif
|
||||
if (!GPIO_IS_VALID_GPIO((int)pin)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,12 +72,8 @@ void digitalWrite(uint32_t pin, uint32_t val)
|
||||
|
||||
int digitalRead(uint32_t pin)
|
||||
{
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
if (pin > 35) {
|
||||
#elif defined(TARGET_MCU_ESP32S2)
|
||||
if (pin > 43) {
|
||||
#endif
|
||||
return 0;
|
||||
if (!GPIO_IS_VALID_GPIO((int)pin)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int val = gpio_get_level(pin);
|
||||
|
||||
@@ -74,20 +74,21 @@ void spiBegin(void)
|
||||
/*.pre_cb = lcd_spi_pre_transfer_callback, //Specify pre-transfer callback to handle D/C line*/
|
||||
};
|
||||
//Initialize the SPI bus
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
ret = spi_bus_initialize(HSPI_HOST, &buscfg, 1);
|
||||
#elif defined(TARGET_MCU_ESP32S2)
|
||||
ret = spi_bus_initialize(HSPI_HOST, &buscfg, 2);
|
||||
spi_host_device_t host_id = SPI2_HOST;
|
||||
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0))
|
||||
ret = spi_bus_initialize(host_id, &buscfg, SPI_DMA_CH_AUTO);
|
||||
#else
|
||||
int dma_chan = host_id; //set dma channel equals to host_id by default
|
||||
ret = spi_bus_initialize(host_id, &buscfg, dma_chan);
|
||||
#endif
|
||||
ESP_ERROR_CHECK(ret);
|
||||
//Attach the pmw3901 to the SPI bus
|
||||
ret = spi_bus_add_device(HSPI_HOST, &devcfg, &spi);
|
||||
ret = spi_bus_add_device(host_id, &devcfg, &spi);
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
||||
isInit = true;
|
||||
}
|
||||
|
||||
|
||||
static void spiConfigureWithSpeed(uint32_t baudRatePrescaler)
|
||||
{
|
||||
//TODO:
|
||||
@@ -105,7 +106,7 @@ bool spiExchange(size_t length, bool is_tx, const uint8_t *data_tx, uint8_t *dat
|
||||
}
|
||||
|
||||
if (length == 0) {
|
||||
return; //no need to send anything
|
||||
return true; //no need to send anything
|
||||
}
|
||||
|
||||
esp_err_t ret;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
|
||||
idf_component_register(SRCS "adc_esp32.c"
|
||||
INCLUDE_DIRS "." "include"
|
||||
REQUIRES crazyflie config esp_adc_cal)
|
||||
REQUIRES crazyflie config esp_adc)
|
||||
else()
|
||||
idf_component_register(SRCS "adc_esp32.c"
|
||||
INCLUDE_DIRS "." "include"
|
||||
REQUIRES crazyflie config esp_adc_cal)
|
||||
endif()
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "esp_idf_version.h"
|
||||
#include "driver/adc.h"
|
||||
#include "esp_adc_cal.h"
|
||||
|
||||
#include "adc_esp32.h"
|
||||
#include "config.h"
|
||||
#include "pm_esplane.h"
|
||||
@@ -34,43 +34,18 @@
|
||||
static bool isInit;
|
||||
|
||||
static esp_adc_cal_characteristics_t *adc_chars;
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
static const adc_channel_t channel = ADC_CHANNEL_7; //GPIO35 if ADC1
|
||||
static const adc_bits_width_t width = ADC_WIDTH_BIT_12;
|
||||
#elif defined(TARGET_MCU_ESP32S2)
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
static const adc_channel_t channel = ADC_CHANNEL_1; // GPIO2 if ADC1
|
||||
static const adc_bits_width_t width = ADC_WIDTH_BIT_13;
|
||||
#endif
|
||||
|
||||
static const adc_bits_width_t width = ADC_WIDTH_MAX-1;
|
||||
static const adc_atten_t atten = ADC_ATTEN_DB_11; //11dB attenuation (ADC_ATTEN_DB_11) gives full-scale voltage 3.9V
|
||||
static const adc_unit_t unit = ADC_UNIT_1;
|
||||
#define DEFAULT_VREF 1100 //Use adc2_vref_to_gpio() to obtain a better estimate
|
||||
#define NO_OF_SAMPLES 30 //Multisampling
|
||||
|
||||
static void checkEfuse(void)
|
||||
{
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
//Check if TP is burned into eFuse
|
||||
if (esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP) == ESP_OK) {
|
||||
printf("eFuse Two Point: Supported\n");
|
||||
} else {
|
||||
printf("eFuse Two Point: NOT supported\n");
|
||||
}
|
||||
//Check Vref is burned into eFuse
|
||||
if (esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_VREF) == ESP_OK) {
|
||||
printf("eFuse Vref: Supported\n");
|
||||
} else {
|
||||
printf("eFuse Vref: NOT supported\n");
|
||||
}
|
||||
#elif defined(TARGET_MCU_ESP32S2)
|
||||
if (esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP) == ESP_OK) {
|
||||
printf("eFuse Two Point: Supported\n");
|
||||
} else {
|
||||
printf("Cannot retrieve eFuse Two Point calibration values. Default calibration values will be used.\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void print_char_val_type(esp_adc_cal_value_t val_type)
|
||||
{
|
||||
if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
||||
@@ -106,8 +81,6 @@ void adcInit(void)
|
||||
return;
|
||||
}
|
||||
|
||||
checkEfuse();
|
||||
//Configure ADC
|
||||
if (unit == ADC_UNIT_1) {
|
||||
adc1_config_width(width);
|
||||
adc1_config_channel_atten(channel, atten);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -51,17 +51,16 @@ void ledInit()
|
||||
}
|
||||
|
||||
for (i = 0; i < LED_NUM; i++) {
|
||||
gpio_config_t io_conf;
|
||||
//disable interrupt
|
||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||
io_conf.pin_bit_mask = (1ULL << led_pin[i]);
|
||||
//disable pull-down mode
|
||||
io_conf.pull_down_en = 0;
|
||||
//disable pull-up mode
|
||||
io_conf.pull_up_en = 0;
|
||||
//set as output mode
|
||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||
gpio_config_t io_conf = {
|
||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||
.pin_bit_mask = (1ULL << led_pin[i]),
|
||||
//disable pull-down mode
|
||||
.pull_down_en = 0,
|
||||
//disable pull-up mode
|
||||
.pull_up_en = 0,
|
||||
//set as output mode
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
};
|
||||
//configure GPIO with the given settings
|
||||
gpio_config(&io_conf);
|
||||
ledSet(i, 0);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
idf_component_register(SRCS "wifi_esp32.c"
|
||||
INCLUDE_DIRS "." "include"
|
||||
REQUIRES crazyflie platform config)
|
||||
INCLUDE_DIRS "." "include"
|
||||
REQUIRES crazyflie platform config esp_wifi)
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -27,7 +27,13 @@ static struct sockaddr_in6 source_addr; // Large enough for both IPv4 or IPv6
|
||||
//#define WIFI_SSID "Udp Server"
|
||||
static char WIFI_SSID[32] = "ESP-DRONE";
|
||||
static char WIFI_PWD[64] = "12345678" ;
|
||||
#define MAX_STA_CONN (1)
|
||||
static uint8_t WIFI_CH = 1;
|
||||
#define MAX_STA_CONN (3)
|
||||
|
||||
#ifndef MAC2STR
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#endif
|
||||
|
||||
static char rx_buffer[UDP_SERVER_BUFSIZE];
|
||||
static char tx_buffer[UDP_SERVER_BUFSIZE];
|
||||
@@ -65,18 +71,14 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base,
|
||||
{
|
||||
if (event_id == WIFI_EVENT_AP_STACONNECTED) {
|
||||
wifi_event_ap_staconnected_t *event = (wifi_event_ap_staconnected_t *) event_data;
|
||||
DEBUG_PRINT_LOCAL("station "MACSTR" join, AID=%d",
|
||||
MAC2STR(event->mac), event->aid);
|
||||
DEBUG_PRINT_LOCAL("station" MACSTR "join, AID=%d", MAC2STR(event->mac), event->aid);
|
||||
|
||||
} else if (event_id == WIFI_EVENT_AP_STADISCONNECTED) {
|
||||
wifi_event_ap_stadisconnected_t *event = (wifi_event_ap_stadisconnected_t *) event_data;
|
||||
DEBUG_PRINT_LOCAL("station "MACSTR" leave, AID=%d",
|
||||
MAC2STR(event->mac), event->aid);
|
||||
DEBUG_PRINT_LOCAL("station" MACSTR "leave, AID=%d", MAC2STR(event->mac), event->aid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool wifiTest(void)
|
||||
{
|
||||
return isInit;
|
||||
@@ -224,13 +226,17 @@ void wifiInit(void)
|
||||
ESP_ERROR_CHECK(esp_wifi_get_mac(ESP_IF_WIFI_AP, mac));
|
||||
sprintf(WIFI_SSID, "ESP-DRONE_%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
wifi_config_t wifi_config;
|
||||
wifi_config_t wifi_config = {
|
||||
.ap = {
|
||||
.channel = WIFI_CH,
|
||||
.max_connection = MAX_STA_CONN,
|
||||
.authmode = WIFI_AUTH_WPA_WPA2_PSK,
|
||||
},
|
||||
};
|
||||
|
||||
memcpy(wifi_config.ap.ssid, WIFI_SSID, strlen(WIFI_SSID) + 1) ;
|
||||
wifi_config.ap.ssid_len = strlen(WIFI_SSID);
|
||||
memcpy(wifi_config.ap.password, WIFI_PWD, strlen(WIFI_PWD) + 1) ;
|
||||
wifi_config.ap.max_connection = MAX_STA_CONN;
|
||||
wifi_config.ap.authmode = WIFI_AUTH_WPA_WPA2_PSK;
|
||||
wifi_config.ap.channel = 13;
|
||||
|
||||
if (strlen(WIFI_PWD) == 0) {
|
||||
wifi_config.ap.authmode = WIFI_AUTH_OPEN;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
idf_component_register(SRCS "i2c_drv.c" "i2cdev_esp32.c"
|
||||
INCLUDE_DIRS "include"
|
||||
REQUIRES crazyflie platform
|
||||
REQUIRES crazyflie platform driver
|
||||
PRIV_REQUIRES config)
|
||||
@@ -109,14 +109,8 @@ void i2cdrvInit(I2cDrv *i2c)
|
||||
i2cdrvInitBus(i2c);
|
||||
}
|
||||
|
||||
static void i2cdrvTryToRestartBus(I2cDrv *i2c)
|
||||
void i2cdrvTryToRestartBus(I2cDrv *i2c)
|
||||
{
|
||||
i2cdrvInitBus(i2c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -25,21 +25,17 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_spi_flash.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "eeprom.h"
|
||||
#include "debug_cf.h"
|
||||
#include "eprintf.h"
|
||||
|
||||
|
||||
#ifdef EEPROM_RUN_WRITE_READ_TEST
|
||||
#include "esp_spi_flash.h"
|
||||
static bool eepromTestWriteRead(void);
|
||||
#endif
|
||||
|
||||
static uint8_t devAddr;
|
||||
static I2C_Dev *I2Cx;
|
||||
static bool isInit;
|
||||
|
||||
bool eepromInit(I2C_Dev *i2cPort)
|
||||
@@ -48,9 +44,7 @@ bool eepromInit(I2C_Dev *i2cPort)
|
||||
return true;
|
||||
}
|
||||
|
||||
// I2Cx = i2cPort;
|
||||
// devAddr = EEPROM_I2C_ADDR;
|
||||
spi_flash_init();
|
||||
//TODOspi_flash_init();
|
||||
DEBUG_PRINTI("spi_flash_init ... !");
|
||||
|
||||
isInit = true;
|
||||
@@ -107,7 +101,7 @@ bool eepromTestConnection(void)
|
||||
bool eepromReadBuffer(uint8_t *buffer, size_t readAddr, size_t len)
|
||||
{
|
||||
bool status = false;
|
||||
esp_err_t err = spi_flash_read(readAddr, buffer, len);
|
||||
esp_err_t err = ESP_OK; //TODO spi_flash_read(readAddr, buffer, len);
|
||||
|
||||
if (err == ESP_OK) {
|
||||
|
||||
@@ -126,7 +120,8 @@ bool eepromWriteBuffer(uint8_t *buffer, size_t writeAddr, size_t len)
|
||||
bool status = false;
|
||||
writeAddr += EEPROM_IN_FLASH_ADDR;
|
||||
|
||||
if (spi_flash_write(writeAddr, buffer, len) == ESP_OK) {
|
||||
//TODO if (spi_flash_write(writeAddr, buffer, len) == ESP_OK) {
|
||||
if (1) {
|
||||
|
||||
status = true;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ uint16_t vl53l0xReadReg16Bit(VL53L0xDev *dev, uint8_t reg);
|
||||
static bool vl53l0xWriteReg16Bit(VL53L0xDev *dev, uint8_t reg, uint16_t val);
|
||||
static bool vl53l0xWriteReg32Bit(VL53L0xDev *dev, uint8_t reg, uint32_t val);
|
||||
|
||||
static int nextI2CAddress = VL53L0X_DEFAULT_ADDRESS + 1;
|
||||
//static int nextI2CAddress = VL53L0X_DEFAULT_ADDRESS + 1;
|
||||
|
||||
/** Default constructor, uses default I2C address.
|
||||
* @see VL53L0X_DEFAULT_ADDRESS
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
COMPONENT_ADD_INCLUDEDIRS := . include core/inc
|
||||
COMPONENT_SRCDIRS := . core/src
|
||||
@@ -86,10 +86,10 @@ static void flowdeckTask(void *param)
|
||||
|
||||
while (1) {
|
||||
// if task watchdog triggered,flow frequency should set lower
|
||||
#ifdef TARGET_MCU_ESP32S2
|
||||
vTaskDelay(10);
|
||||
#elif defined(TARGET_MCU_ESP32)
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||
vTaskDelay(10);
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32)
|
||||
vTaskDelay(5);
|
||||
#endif
|
||||
|
||||
pmw3901ReadMotion(NCS_PIN, ¤tMotion);
|
||||
@@ -122,10 +122,10 @@ static void flowdeckTask(void *param)
|
||||
flowData.stdDevY = stdFlow; // [pixels] should perhaps be made larger?
|
||||
|
||||
// if task watchdog triggered,flow frequency should set lower
|
||||
#ifdef TARGET_MCU_ESP32S2
|
||||
flowData.dt = 0.01;
|
||||
#elif defined(TARGET_MCU_ESP32)
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||
flowData.dt = 0.01;
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32)
|
||||
flowData.dt = 0.005;
|
||||
#endif
|
||||
|
||||
#if defined(USE_MA_SMOOTHING)
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
idf_component_register(SRC_DIRS "BasicMathFunctions"
|
||||
"CommonTables"
|
||||
"ComplexMathFunctions"
|
||||
"ControllerFunctions"
|
||||
"FastMathFunctions"
|
||||
"FilteringFunctions"
|
||||
"MatrixFunctions"
|
||||
"StatisticsFunctions"
|
||||
"TransformFunctions"
|
||||
INCLUDE_DIRS "include")
|
||||
"CommonTables"
|
||||
"ComplexMathFunctions"
|
||||
"ControllerFunctions"
|
||||
"FastMathFunctions"
|
||||
"FilteringFunctions"
|
||||
"MatrixFunctions"
|
||||
"StatisticsFunctions"
|
||||
"TransformFunctions"
|
||||
INCLUDE_DIRS "include"
|
||||
)
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PUBLIC "-fno-strict-aliasing")
|
||||
@@ -1,4 +0,0 @@
|
||||
COMPONENT_SRCDIRS:=BasicMathFunctions CommonTables ComplexMathFunctions ControllerFunctions \
|
||||
FastMathFunctions FilteringFunctions MatrixFunctions StatisticsFunctions\
|
||||
TransformFunctions
|
||||
CFLAGS += -D ARM_MATH_CM4
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -31,24 +31,19 @@
|
||||
#error
|
||||
#endif
|
||||
|
||||
|
||||
#define DEFAULT_PLATFORM_STRING "0;EP20"
|
||||
|
||||
|
||||
#ifndef UNIT_TEST_MODE
|
||||
static char *getAddressOfOtpMemoryBlock(int blockNr)
|
||||
{
|
||||
//TODO:
|
||||
//return block adress
|
||||
return (char *)(0x1fff7800 + blockNr * 0x20);
|
||||
}
|
||||
#else
|
||||
// This function is replaced by a mock in unit tests
|
||||
char *getAddressOfOtpMemoryBlock(const int blockNr);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// //TODO:
|
||||
// #ifndef UNIT_TEST_MODE
|
||||
// static char *getAddressOfOtpMemoryBlock(int blockNr)
|
||||
// {
|
||||
// //return block adress
|
||||
// return (char *)(0x1fff7800 + blockNr * 0x20);
|
||||
// }
|
||||
// #else
|
||||
// // This function is replaced by a mock in unit tests
|
||||
// char *getAddressOfOtpMemoryBlock(const int blockNr);
|
||||
// #endif
|
||||
|
||||
void platformGetDeviceTypeString(char *deviceTypeString)
|
||||
{
|
||||
|
||||
@@ -5,34 +5,14 @@ Set up Development Environment
|
||||
Set up ESP-IDF Environment
|
||||
---------------------------------
|
||||
|
||||
Please refer to `ESP-IDF Programming Guide <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html>`__\ and set up ESP-IDF environmnet step by step.
|
||||
Please refer to `ESP-IDF Programming Guide <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html>`__\ and set up ESP-IDF environmnet step by step.
|
||||
|
||||
.. note::
|
||||
|
||||
- ESP-IDF branch ``release /v4.2`` is suggested.
|
||||
- ESP-IDF branch ``release /v4.4`` is suggested.
|
||||
- Please follow and complete all setup steps.
|
||||
- Build a example of ESP-IDF to make sure the setup is successful.
|
||||
|
||||
Modify ESP32/ESP32-S2 Link Script
|
||||
--------------------------------------
|
||||
|
||||
Open the link script template for ESP32/ESP32-S2 ``${IDF_PATH}/components/esp32/ld/esp32.project.ld.in`` and ``${IDF_PATH}/components/esp32s2/ld/esp32s2.project.ld.in``\. Put the following code at the end of ``.flash.rodata``.
|
||||
|
||||
::
|
||||
|
||||
/* Parameters and log system data */
|
||||
_param_start = .;
|
||||
KEEP(*(.param))
|
||||
KEEP(*(.param.*))
|
||||
_param_stop = .;
|
||||
. = ALIGN(4);
|
||||
_log_start = .;
|
||||
KEEP(*(.log))
|
||||
KEEP(*(.log.*))
|
||||
_log_stop = .;
|
||||
. = ALIGN(4);
|
||||
|
||||
The above code can place variables with ``.param.*`` or ``.log.*`` segment attributes at continuous storage area so as to speed up variable traversal.
|
||||
|
||||
Get Project Source Code
|
||||
---------------------------------------------------
|
||||
|
||||
@@ -87,7 +87,7 @@ ESP-IDF is the IoT Development Framework provided by Espressif for ESP32/ESP32-S
|
||||
|
||||
|
||||
For more information, please check `ESP-IDF
|
||||
Programming Guide <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/index.html>`__.
|
||||
Programming Guide <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html>`__.
|
||||
|
||||
Crazyflie Overview
|
||||
=======================
|
||||
|
||||
@@ -124,7 +124,7 @@ The priority of system tasks can be configured in ``components/config/include/co
|
||||
#define UART1_TEST_TASK_PRI 1
|
||||
#define UART2_TEST_TASK_PRI 1
|
||||
//if task watchdog triggered, KALMAN_TASK_PRI should set lower or set lower flow frequency
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define KALMAN_TASK_PRI 2
|
||||
#define LOG_TASK_PRI 1
|
||||
#define MEM_TASK_PRI 1
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## ESP-IDF 环境搭建
|
||||
|
||||
请参照 [ESP-IDF 编程指南](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/index.html),按照步骤设置 ESP-IDF。
|
||||
请参照 [ESP-IDF 编程指南](https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html),按照步骤设置 ESP-IDF。
|
||||
|
||||
注意事项:
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
_param_start = .;
|
||||
KEEP(*(.param))
|
||||
KEEP(*(.param.*))
|
||||
_param_stop = .;
|
||||
_param_end = .;
|
||||
. = ALIGN(4);
|
||||
_log_start = .;
|
||||
KEEP(*(.log))
|
||||
KEEP(*(.log.*))
|
||||
_log_stop = .;
|
||||
_log_end = .;
|
||||
. = ALIGN(4);
|
||||
```
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ ESP-IDF 是乐鑫为 ESP32/ESP32-S2 提供的物联网开发框架。
|
||||
* ESP-IDF 包含一系列库及头文件,提供了基于 ESP32/ESP32-S2 构建软件项目所需的核心组件。
|
||||
* ESP-IDF 还提供了开发和量产过程中最常用的工具及功能,例如:构建、烧录、调试和测量等。
|
||||
|
||||
详情可查阅:[ESP-IDF 编程指南](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/index.html)。
|
||||
详情可查阅:[ESP-IDF 编程指南](https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html)。
|
||||
|
||||
## Crazyflie 简介
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ TASK 具体描述如下:
|
||||
#define UART1_TEST_TASK_PRI 1
|
||||
#define UART2_TEST_TASK_PRI 1
|
||||
//if task watchdog triggered, KALMAN_TASK_PRI should set lower or set lower flow frequency
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define KALMAN_TASK_PRI 2
|
||||
#define LOG_TASK_PRI 1
|
||||
#define MEM_TASK_PRI 1
|
||||
|
||||
@@ -5,34 +5,14 @@
|
||||
ESP-IDF 环境搭建
|
||||
----------------
|
||||
|
||||
请参照 `ESP-IDF 编程指南 <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/index.html>`__\ ,按照步骤设置 ESP-IDF。
|
||||
请参照 `ESP-IDF 编程指南 <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html>`__\ ,按照步骤设置 ESP-IDF。
|
||||
|
||||
注意事项:
|
||||
|
||||
- 推荐安装 ESP-IDF `release/v4.2` 分支;
|
||||
- 推荐安装 ESP-IDF `release/v4.4` 分支;
|
||||
- 请完成 ESP-IDF 所有安装步骤;
|
||||
- 建议首先编译一个 ESP-IDF 示例程序,用以检查安装的完整性。
|
||||
|
||||
ESP32/ESP32-S2 链接脚本修改
|
||||
---------------------------
|
||||
|
||||
打开 ESP32/ESP32-S2 的链接脚本模板 ``${IDF_PATH}/components/esp32/ld/esp32.project.ld.in`` 和 ``${IDF_PATH}/components/esp32s2/ld/esp32s2.project.ld.in``\ ,将以下代码添加到 ``.flash.rodata`` 段的末尾。
|
||||
|
||||
::
|
||||
|
||||
/* Parameters and log system data */
|
||||
_param_start = .;
|
||||
KEEP(*(.param))
|
||||
KEEP(*(.param.*))
|
||||
_param_stop = .;
|
||||
. = ALIGN(4);
|
||||
_log_start = .;
|
||||
KEEP(*(.log))
|
||||
KEEP(*(.log.*))
|
||||
_log_stop = .;
|
||||
. = ALIGN(4);
|
||||
|
||||
以上代码可以实现将具有 ``.param.*`` 或 ``.log.*`` 段属性的变量,放置在连续的存储区域,从而加快变量遍历速度。
|
||||
|
||||
获取项目源代码
|
||||
--------------
|
||||
|
||||
@@ -60,7 +60,7 @@ ESP-IDF 是乐鑫为 ESP32/ESP32-S2 提供的物联网开发框架。
|
||||
- ESP-IDF 包含一系列库及头文件,提供了基于 ESP32/ESP32-S2 构建软件项目所需的核心组件。
|
||||
- ESP-IDF 还提供了开发和量产过程中最常用的工具及功能,例如:构建、烧录、调试和测量等。
|
||||
|
||||
详情可查阅:`ESP-IDF 编程指南 <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/index.html>`__。
|
||||
详情可查阅:`ESP-IDF 编程指南 <https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/get-started/index.html>`__。
|
||||
|
||||
Crazyflie 简介
|
||||
================
|
||||
|
||||
@@ -135,7 +135,7 @@ TASK 具体描述如下:
|
||||
#define UART1_TEST_TASK_PRI 1
|
||||
#define UART2_TEST_TASK_PRI 1
|
||||
//if task watchdog triggered, KALMAN_TASK_PRI should set lower or set lower flow frequency
|
||||
#ifdef TARGET_MCU_ESP32
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define KALMAN_TASK_PRI 2
|
||||
#define LOG_TASK_PRI 1
|
||||
#define MEM_TASK_PRI 1
|
||||
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
idf_component_register(SRCS "main.c"
|
||||
INCLUDE_DIRS "." )
|
||||
INCLUDE_DIRS "."
|
||||
LDFRAGMENTS linker_fragment.lf)
|
||||
@@ -2,6 +2,7 @@ menu "ESPDrone Config"
|
||||
|
||||
choice
|
||||
prompt "ESP_Drone hardware version"
|
||||
default TARGET_ESP32_S2_DRONE_V1_2 if IDF_TARGET_ESP32S3
|
||||
default TARGET_ESP32_S2_DRONE_V1_2 if IDF_TARGET_ESP32S2
|
||||
default TARGET_ESPLANE_V1 if IDF_TARGET_ESP32
|
||||
|
||||
@@ -12,7 +13,7 @@ menu "ESPDrone Config"
|
||||
bool "esplane with esp32-s2 onboard"
|
||||
|
||||
config TARGET_ESP32_S2_DRONE_V1_2
|
||||
bool "esp-drone with esp32-s2 onboard"
|
||||
bool "esp-drone with esp32-s2/s3 onboard"
|
||||
|
||||
endchoice
|
||||
|
||||
@@ -70,9 +71,9 @@ menu "ESPDrone Config"
|
||||
config BASE_STACK_SIZE
|
||||
int "base stack size for system task"
|
||||
range 512 1024
|
||||
default 512 if TARGET_ESPLANE_V2_S2
|
||||
default 512 if TARGET_ESP32_S2_DRONE_V1_2
|
||||
default 1024 if TARGET_ESPLANE_V1
|
||||
default 1024 if IDF_TARGET_ESP32
|
||||
default 512 if IDF_TARGET_ESP32S2
|
||||
default 1024 if IDF_TARGET_ESP32S3
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
[sections:_param]
|
||||
entries:
|
||||
.param+
|
||||
|
||||
[sections:_log]
|
||||
entries:
|
||||
.log+
|
||||
|
||||
[scheme:_table]
|
||||
entries:
|
||||
_param -> flash_rodata
|
||||
_log -> flash_rodata
|
||||
|
||||
[mapping:my_project]
|
||||
archive: *
|
||||
entries:
|
||||
* (_table);
|
||||
_param -> flash_rodata KEEP() ALIGN(4, pre, post) SURROUND(param),
|
||||
_log -> flash_rodata KEEP() ALIGN(4, pre, post) SURROUND(log)
|
||||
+9
-110
@@ -1,127 +1,26 @@
|
||||
#
|
||||
# default value. DO NOT EDIT.
|
||||
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
|
||||
#
|
||||
|
||||
#
|
||||
# Component config
|
||||
#
|
||||
|
||||
#
|
||||
# ESP32S2-specific
|
||||
#
|
||||
# CONFIG_ESP32S2_DEFAULT_CPU_FREQ_80 is not set
|
||||
# CONFIG_ESP32S2_DEFAULT_CPU_FREQ_160 is not set
|
||||
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ=240
|
||||
|
||||
#
|
||||
# ESP32-specific
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
|
||||
|
||||
#
|
||||
# PHY
|
||||
#
|
||||
# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
|
||||
CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
|
||||
CONFIG_ESP32_PHY_MAX_TX_POWER=20
|
||||
# end of PHY
|
||||
|
||||
#
|
||||
# FreeRTOS
|
||||
#
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
|
||||
CONFIG_FREERTOS_CORETIMER_0=y
|
||||
# CONFIG_FREERTOS_CORETIMER_1 is not set
|
||||
CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y
|
||||
# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set
|
||||
# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set
|
||||
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y
|
||||
# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set
|
||||
CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y
|
||||
CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
|
||||
CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
|
||||
# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set
|
||||
# CONFIG_FREERTOS_ASSERT_DISABLE is not set
|
||||
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536
|
||||
CONFIG_FREERTOS_ISR_STACKSIZE=1536
|
||||
# CONFIG_FREERTOS_LEGACY_HOOKS is not set
|
||||
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
|
||||
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
||||
# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set
|
||||
CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3072
|
||||
CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10
|
||||
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
|
||||
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
||||
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
|
||||
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
|
||||
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
|
||||
CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER=y
|
||||
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
|
||||
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
|
||||
# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
|
||||
CONFIG_FREERTOS_DEBUG_OCDAWARE=y
|
||||
# end of FreeRTOS
|
||||
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2048
|
||||
CONFIG_FREERTOS_ISR_STACKSIZE=2048
|
||||
CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y
|
||||
|
||||
#
|
||||
# Serial flasher config
|
||||
#
|
||||
CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
|
||||
CONFIG_ESPTOOLPY_FLASHMODE="dio"
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ="80m"
|
||||
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
||||
# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
|
||||
CONFIG_ESPTOOLPY_BEFORE="default_reset"
|
||||
CONFIG_ESPTOOLPY_AFTER_RESET=y
|
||||
# CONFIG_ESPTOOLPY_AFTER_NORESET is not set
|
||||
CONFIG_ESPTOOLPY_AFTER="hard_reset"
|
||||
# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set
|
||||
# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
|
||||
# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set
|
||||
# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set
|
||||
# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set
|
||||
# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
# end of Serial flasher config
|
||||
|
||||
#
|
||||
# Compiler options
|
||||
#
|
||||
# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set
|
||||
# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set
|
||||
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
||||
# CONFIG_COMPILER_OPTIMIZATION_NONE is not set
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
||||
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
|
||||
# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
|
||||
# CONFIG_COMPILER_CXX_EXCEPTIONS is not set
|
||||
# CONFIG_COMPILER_CXX_RTTI is not set
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
|
||||
# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set
|
||||
# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set
|
||||
# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set
|
||||
# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
|
||||
# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set
|
||||
# end of Compiler options
|
||||
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3072
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#
|
||||
# FreeRTOS
|
||||
#
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
@@ -0,0 +1,3 @@
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ=240
|
||||
@@ -0,0 +1,3 @@
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240
|
||||
Reference in New Issue
Block a user