mirror of
https://github.com/apache/nuttx.git
synced 2026-09-27 18:58:27 +08:00
xtensa/esp32: Add Partition and OTA device
This commit is contained in:
committed by
Abdelatif Guettouche
parent
9dadfc5cc3
commit
b54f0edff4
@@ -29,6 +29,14 @@ config ESP32_RT_TIMER
|
|||||||
bool "Real-time Timer"
|
bool "Real-time Timer"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config ESP32_PARTITION
|
||||||
|
bool "ESP32 Partition"
|
||||||
|
default n
|
||||||
|
select ESP32_SPIFLASH
|
||||||
|
---help---
|
||||||
|
Decode esp-idf's partition file and initialize
|
||||||
|
partition by nuttx MTD.
|
||||||
|
|
||||||
menu "ESP32 Peripheral Selection"
|
menu "ESP32 Peripheral Selection"
|
||||||
|
|
||||||
config ESP32_UART
|
config ESP32_UART
|
||||||
@@ -688,4 +696,17 @@ config ESP32_RT_TIMER_TASK_STACK_SIZE
|
|||||||
|
|
||||||
endmenu # Real-Time Timer
|
endmenu # Real-Time Timer
|
||||||
|
|
||||||
|
menu "Partition Configuration"
|
||||||
|
depends on ESP32_PARTITION
|
||||||
|
|
||||||
|
config ESP32_PARTITION_OFFSET
|
||||||
|
hex "Partition offset"
|
||||||
|
default "0x8000"
|
||||||
|
|
||||||
|
config ESP32_PARTITION_MOUNT
|
||||||
|
string "Partition mount point"
|
||||||
|
default "/dev/esp/partition/"
|
||||||
|
|
||||||
|
endmenu # ESP32_PARTITION
|
||||||
|
|
||||||
endif # ARCH_CHIP_ESP32
|
endif # ARCH_CHIP_ESP32
|
||||||
|
|||||||
@@ -153,6 +153,10 @@ ifeq ($(CONFIG_XTENSA_IMEM_PROCFS),y)
|
|||||||
CHIP_CSRCS += esp32_procfs_imm.c
|
CHIP_CSRCS += esp32_procfs_imm.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESP32_PARTITION),y)
|
||||||
|
CHIP_CSRCS += esp32_partition.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT),y)
|
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT),y)
|
||||||
CHIP_CSRCS += esp32_modtext.c
|
CHIP_CSRCS += esp32_modtext.c
|
||||||
CMN_ASRCS += xtensa_loadstore.S
|
CMN_ASRCS += xtensa_loadstore.S
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/xtensa/src/esp32/esp32_partition.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_XTENSA_SRC_ESP32_ESP32_PARTITION_H
|
||||||
|
#define __ARCH_XTENSA_SRC_ESP32_ESP32_PARTITION_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <nuttx/mtd/mtd.h>
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: esp32_partition_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize ESP32 partition. Read partition information of esp-idf,
|
||||||
|
* and create MTD by these data
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0 if success or a negative value if fail.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int esp32_partition_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#undef EXTERN
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_PARTITION_H */
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
|
|
||||||
#include "esp32_wlan.h"
|
#include "esp32_wlan.h"
|
||||||
#include "esp32_spiflash.h"
|
#include "esp32_spiflash.h"
|
||||||
|
#include "esp32_partition.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -184,6 +185,16 @@ int esp32_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ESP32_PARTITION
|
||||||
|
ret = esp32_partition_init();
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to initialize partition error=%d\n",
|
||||||
|
ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_WIRELESS
|
#ifdef CONFIG_ESP32_WIRELESS
|
||||||
|
|
||||||
#ifdef CONFIG_ESP32_WIFI_SAVE_PARAM
|
#ifdef CONFIG_ESP32_WIFI_SAVE_PARAM
|
||||||
|
|||||||
Reference in New Issue
Block a user