From 4545892223d622160243bbce95d8f42a19972ade Mon Sep 17 00:00:00 2001 From: ou-yangkan <519689417@qq.com> Date: Tue, 28 Dec 2021 17:39:20 +0800 Subject: [PATCH] add soc esp32_wrover_ie Signed-off-by: ou-yangkan <519689417@qq.com> --- BUILD.gn | 20 ++ Kconfig.liteos_m.defconfig | 18 + Kconfig.liteos_m.series | 14 + Kconfig.liteos_m.soc | 22 ++ LICENSE | 177 ++++++++++ README.md | 163 +++++++-- esp32_wrover_ie/BUILD.gn | 21 ++ ...Kconfig.liteos_m.defconfig.esp32_wrover_ie | 17 + .../Kconfig.liteos_m.defconfig.series | 31 ++ esp32_wrover_ie/Kconfig.liteos_m.series | 21 ++ esp32_wrover_ie/Kconfig.liteos_m.soc | 21 ++ esp32_wrover_ie/liteos_m/BUILD.gn | 22 ++ esp32_wrover_ie/liteos_m/components/BUILD.gn | 22 ++ .../liteos_m/components/drivers/BUILD.gn | 21 ++ .../components/drivers/hal_watchdog.c | 86 +++++ .../liteos_m/components/fs/BUILD.gn | 36 ++ .../liteos_m/components/fs/fs_config.h | 220 ++++++++++++ .../liteos_m/components/fs/fs_init.c | 82 +++++ .../liteos_m/components/fs/fs_init.h | 52 +++ .../liteos_m/components/fs/littlefs_hal.c | 105 ++++++ .../liteos_m/components/utils/BUILD.gn | 33 ++ .../liteos_m/components/utils/src/dprintf.c | 165 +++++++++ .../liteos_m/components/utils/src/swap.c | 41 +++ .../liteos_m/hals/utils/file/BUILD.gn | 24 ++ .../liteos_m/hals/utils/file/src/hal_file.c | 86 +++++ esp32_wrover_ie/liteos_m/sdk/BUILD.gn | 43 +++ .../liteos_m/sdk/include/board/soc.h | 55 +++ .../sdk/include/watchdog/hal_watchdog.h | 76 ++++ .../liteos_m/sdk/rtos/liteos/liteos_m/main.c | 87 +++++ .../sdk/rtos/liteos/liteos_m/target_config.h | 121 +++++++ .../sdk/rtos/liteos/liteos_m/test/task_demo.c | 78 +++++ .../sdk/rtos/liteos/liteos_m/test/task_demo.h | 53 +++ .../liteos_m/sdk/scripts/link/ESP32.ld | 330 ++++++++++++++++++ esp32_wrover_ie/pack_tools/bootloader.bin | Bin 0 -> 26656 bytes .../pack_tools/partition-table.bin | Bin 0 -> 3072 bytes esp32_wrover_ie/readme_zh.md | 43 +++ 36 files changed, 2381 insertions(+), 25 deletions(-) create mode 100644 BUILD.gn create mode 100644 Kconfig.liteos_m.defconfig create mode 100644 Kconfig.liteos_m.series create mode 100644 Kconfig.liteos_m.soc create mode 100644 LICENSE create mode 100644 esp32_wrover_ie/BUILD.gn create mode 100644 esp32_wrover_ie/Kconfig.liteos_m.defconfig.esp32_wrover_ie create mode 100644 esp32_wrover_ie/Kconfig.liteos_m.defconfig.series create mode 100644 esp32_wrover_ie/Kconfig.liteos_m.series create mode 100644 esp32_wrover_ie/Kconfig.liteos_m.soc create mode 100644 esp32_wrover_ie/liteos_m/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/components/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/components/drivers/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/components/drivers/hal_watchdog.c create mode 100644 esp32_wrover_ie/liteos_m/components/fs/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/components/fs/fs_config.h create mode 100644 esp32_wrover_ie/liteos_m/components/fs/fs_init.c create mode 100644 esp32_wrover_ie/liteos_m/components/fs/fs_init.h create mode 100644 esp32_wrover_ie/liteos_m/components/fs/littlefs_hal.c create mode 100644 esp32_wrover_ie/liteos_m/components/utils/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/components/utils/src/dprintf.c create mode 100644 esp32_wrover_ie/liteos_m/components/utils/src/swap.c create mode 100644 esp32_wrover_ie/liteos_m/hals/utils/file/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/hals/utils/file/src/hal_file.c create mode 100644 esp32_wrover_ie/liteos_m/sdk/BUILD.gn create mode 100644 esp32_wrover_ie/liteos_m/sdk/include/board/soc.h create mode 100644 esp32_wrover_ie/liteos_m/sdk/include/watchdog/hal_watchdog.h create mode 100644 esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/main.c create mode 100644 esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/target_config.h create mode 100644 esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.c create mode 100644 esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.h create mode 100644 esp32_wrover_ie/liteos_m/sdk/scripts/link/ESP32.ld create mode 100644 esp32_wrover_ie/pack_tools/bootloader.bin create mode 100644 esp32_wrover_ie/pack_tools/partition-table.bin create mode 100644 esp32_wrover_ie/readme_zh.md diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000..42b522e --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +if (ohos_kernel_type == "liteos_m") { + import("//kernel/liteos_m/liteos.gni") + module_name = get_path_info(rebase_path("."), "name") + module_group(module_name) { + modules = [ "esp32_wrover_ie" ] + } +} diff --git a/Kconfig.liteos_m.defconfig b/Kconfig.liteos_m.defconfig new file mode 100644 index 0000000..3557b7d --- /dev/null +++ b/Kconfig.liteos_m.defconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +rsource "*/Kconfig.liteos_m.defconfig.series" + +config HALS_COMMUCATION_WIFI_LITE + bool "WIFI LITE" + default n \ No newline at end of file diff --git a/Kconfig.liteos_m.series b/Kconfig.liteos_m.series new file mode 100644 index 0000000..5e6587e --- /dev/null +++ b/Kconfig.liteos_m.series @@ -0,0 +1,14 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +rsource "*/Kconfig.liteos_m.series" diff --git a/Kconfig.liteos_m.soc b/Kconfig.liteos_m.soc new file mode 100644 index 0000000..f94294e --- /dev/null +++ b/Kconfig.liteos_m.soc @@ -0,0 +1,22 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +config SOC_COMPANY_ESPRESSIF + bool + +if SOC_COMPANY_ESPRESSIF +config SOC_COMPANY + default "espressif" + +rsource "*/Kconfig.liteos_m.soc" +endif # SOC_COMPANY_ESPRESSIF \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4947287 --- /dev/null +++ b/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/README.md b/README.md index aabcc1a..9a3f493 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,152 @@ # device_espressif #### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} -#### 软件架构 -软件架构说明 +##### 目录 +``` +device/soc/espressif +├── esp32_wrover_ie # 芯片SOC名称 +├── ... # 芯片SOC名称 +├── Kconfig.liteos_m.defconfig # kconfig 默认宏配置 +├── Kconfig.liteos_m.series # bes系列soc配置宏 +└── Kconfig.liteos_m.soc # soc kconfig配置宏 +``` -#### 安装教程 +编译环境搭建包含如下几步: +1. 环境搭建 +2. 获取源码 +3. 源码构建 +4. 在开发板中运行镜像 -1. xxxx -2. xxxx -3. xxxx +## 1.环境搭建 -#### 使用说明 + 1. esp-idf安装 -1. xxxx -2. xxxx -3. xxxx + 使用安装指导请参考:(https://docs.espressif.com/projects/esp-idf/zh_CN/release-v4.1/get-started/index.html) -#### 参与贡献 + 2. esptool安装 -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request + ```shell + python -m pip install esptool + ``` + 3. hb工具安装 + a) 运行如下命令安装hb -#### 特技 + ``` + pip3 install build/lite + ``` + b) 设置环境变量 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) + ``` + vim ~/.bashrc + ``` + + 将以下命令拷贝到.bashrc文件的最后一行,保存并退出。 + + ``` + export PATH=~/.local/bin:$PATH + ``` + + 执行如下命令更新环境变量。 + + ``` + source ~/.bashrc + ``` + c) 执行"hb -h",有打印以下信息即表示安装成功: + + ``` + usage: hb + + OHOS build system + + positional arguments: + {build,set,env,clean} + build Build source code + set OHOS build settings + env Show OHOS build env + clean Clean output + + optional arguments: + -h, --help show this help message and exit + ``` + + 3. 编译镜像 + + a) 生成bootloader.bin + + ```shell + $ cd esp-idf + $ ./install.sh + $ ./export.sh + $ cd examples/get-started/hello_world + $ make menuconfig + (关掉 Partition Table -> [*] Generate an MD5 checksum for the partition table 选项) + $ make bootloader + ``` + + b) 生成分区表 + + 使用`gen_esp32part.py`脚本将用户自定义csv文件转换为对应bin文件,如: + ```shell + $ gen_esp32part.py partitions_user.csv partitions_user.bin --disable-md5sum + ``` + + esp32 csv文件可参考以下配置: + + ``` + nvs,data,nvs,0x9000,24K, + phy_init,data,phy,0xf000,4K, + factory,app,factory,0x10000,1M, + ``` + +## 2.获取源码 + +[代码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md) + +提示: 可以使用 `repo` 命令来获取源码。 + +## 3.源码构建 + + 1. 执行hb set命令并选择项目`esp32_wrover_ie_demo`。 + + 2. 执行hb clean && hb build命令构建产生 `OHOS_Image` 的可执行文件。 + + ```shell + $ hb set + $ hb clean && hb build + ``` + + 3. 在构建完成之后,对应的可执行文件在主目录下: + + ``` + out/esp32_devkitc_v4/esp32_wrover_ie_demo/ + ``` + + 4. 在主目录下执行以下命令生成bin文件: + + ```shell + esptool.py --chip esp32 elf2image --flash_mode dio --flash_freq 80m \ + --flash_size 4MB -o out/esp32_devkitc_v4/esp32_wrover_ie_demo/OHOS_Image.bin out/esp32_devkitc_v4/esp32_wrover_ie_demo/OHOS_Image + ``` + +## 4.在开发板中运行镜像 + + 1. 下载烧录工具 + + 烧录工具链接:https://www.espressif.com/sites/default/files/tools/flash_download_tool_v3.8.8.zip + + 2. 使用烧录工具 + + 使用参考 https://docs.ai-thinker.com/esp_download 中 “不支持OTA” 的FLASH地址配置方式: + + a) 配置bootloader.bin在地址0x1000,配置partition-table.bin在地址0x8000,配置OHOS_Image.bin在地址0x10000。 + + b) 配置SPI SPEED为40MHz,配置SPI MODE为DOUT,配置FLASH SIZE为8Mbit,波特率设置为115200。 + + c) 点击START开始下载。 + +注1:如果没有手动生成bootloader.bin和分区表,可以直接使用vendor/esp/esp32/image下的bootloader.bin和分区表。 + +注2:烧录用的bin文件需要按照4-4中的方法使用esptool.py工具生成。 diff --git a/esp32_wrover_ie/BUILD.gn b/esp32_wrover_ie/BUILD.gn new file mode 100644 index 0000000..52d9947 --- /dev/null +++ b/esp32_wrover_ie/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//build/lite/config/component/lite_component.gni") +import("//build/lite/config/subsystem/lite_subsystem.gni") +import("//kernel/liteos_m/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +module_group(module_name) { + modules = [ "liteos_m" ] +} diff --git a/esp32_wrover_ie/Kconfig.liteos_m.defconfig.esp32_wrover_ie b/esp32_wrover_ie/Kconfig.liteos_m.defconfig.esp32_wrover_ie new file mode 100644 index 0000000..66ffbd2 --- /dev/null +++ b/esp32_wrover_ie/Kconfig.liteos_m.defconfig.esp32_wrover_ie @@ -0,0 +1,17 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +config SOC + string + default "esp32_wrover_ie" + depends on SOC_ESP32 diff --git a/esp32_wrover_ie/Kconfig.liteos_m.defconfig.series b/esp32_wrover_ie/Kconfig.liteos_m.defconfig.series new file mode 100644 index 0000000..2f54e2d --- /dev/null +++ b/esp32_wrover_ie/Kconfig.liteos_m.defconfig.series @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +if SOC_SERIES_ESP32 + +rsource "Kconfig.liteos_m.defconfig.esp32_wrover_ie" + +config SOC_SERIES + string + default "esp32_wrover_ie" + +config NUM_IRQS + int + default 1 + +config SYS_CLOCK_HW_CYCLES_PER_SEC + int + default 24000000 + +endif + diff --git a/esp32_wrover_ie/Kconfig.liteos_m.series b/esp32_wrover_ie/Kconfig.liteos_m.series new file mode 100644 index 0000000..b7c9866 --- /dev/null +++ b/esp32_wrover_ie/Kconfig.liteos_m.series @@ -0,0 +1,21 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +config SOC_SERIES_ESP32 + bool "Espressif Series" + select XTENSA + select SOC_COMPANY_ESPRESSIF + select CPU_LX6 + help + Enable support for esp32_wrover_ie series + diff --git a/esp32_wrover_ie/Kconfig.liteos_m.soc b/esp32_wrover_ie/Kconfig.liteos_m.soc new file mode 100644 index 0000000..d43fe20 --- /dev/null +++ b/esp32_wrover_ie/Kconfig.liteos_m.soc @@ -0,0 +1,21 @@ +# Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. +# Licensed 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. + +choice + prompt "Esp32_wrover_ie series SoC" + depends on SOC_SERIES_ESP32 + +config SOC_ESP32 + bool "SoC ESP32" + +endchoice diff --git a/esp32_wrover_ie/liteos_m/BUILD.gn b/esp32_wrover_ie/liteos_m/BUILD.gn new file mode 100644 index 0000000..918d416 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//kernel/liteos_m/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +module_group(module_name) { + modules = [ + "sdk", + "components", + ] +} diff --git a/esp32_wrover_ie/liteos_m/components/BUILD.gn b/esp32_wrover_ie/liteos_m/components/BUILD.gn new file mode 100644 index 0000000..1ddf95b --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +module_group("components") { + modules = [ + "drivers", + "fs", + "utils", + ] +} diff --git a/esp32_wrover_ie/liteos_m/components/drivers/BUILD.gn b/esp32_wrover_ie/liteos_m/components/drivers/BUILD.gn new file mode 100644 index 0000000..3719fee --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/drivers/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +kernel_module("drivers") { + sources = [ "hal_watchdog.c" ] + + include_dirs = + [ "//device/soc/espressif/esp32_wrover_ie/liteos_m/sdk/include/watchdog" ] +} diff --git a/esp32_wrover_ie/liteos_m/components/drivers/hal_watchdog.c b/esp32_wrover_ie/liteos_m/components/drivers/hal_watchdog.c new file mode 100644 index 0000000..f7d3b1a --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/drivers/hal_watchdog.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "hal_watchdog.h" + +VOID WdtEnable(VOID) +{ + if (REG32_READ(RTC_WDT_CFG0) & (1 << RTC_CNTL_WDT_EN)) { + return; + } + + if (REG32_READ(RTC_WDT_PROTECT) != WDT_WRWITE_MASK) { + REG32_WRITE(RTC_WDT_PROTECT, WDT_WRWITE_MASK); + } + + REG32_WRITE(RTC_WDT_FEED, (1 << RTC_CNTL_WDT_FEED)); + REG32_WRITE(RTC_WDT_CFG0, (RTC_CNTL_WDT_SYS_RESET << RTC_CNTL_WDT_STG0)); + REG32_WRITE(RTC_WDT_CFG0, (RTC_CNTL_WDT_SYS_RESET_MASK << RTC_CNTL_WDT_SYS_RESET_LENGTH)); + REG32_WRITE(RTC_WDT_CFG0, (1 << RTC_CNTL_WDT_FLASHBOOT_MOD_EN)); + REG32_WRITE(RTC_WDT_CFG0, (1 << RTC_CNTL_WDT_FLASHBOOT_MOD_EN)); + REG32_WRITE(RTC_WDT_CFG0, (1 << RTC_CNTL_WDT_EN)); + REG32_WRITE(RTC_WDT_PROTECT, 0); +} + +VOID WdtDisable(VOID) +{ + if (REG32_READ(RTC_WDT_PROTECT) != WDT_WRWITE_MASK) { + REG32_WRITE(RTC_WDT_PROTECT, WDT_WRWITE_MASK); + } + REG32_WRITE(RTC_WDT_FEED, (1 << RTC_CNTL_WDT_FEED)); + REG32_WRITE(RTC_WDT_CFG0, ~(1 << RTC_CNTL_WDT_FLASHBOOT_MOD_EN)); + REG32_WRITE(RTC_WDT_CFG0, ~(1 << RTC_CNTL_WDT_FLASHBOOT_MOD_EN)); + REG32_WRITE(RTC_WDT_PROTECT, 0); +} + +VOID WdtFeed(VOID) +{ + if (REG32_READ(RTC_WDT_PROTECT) != WDT_WRWITE_MASK) { + REG32_WRITE(RTC_WDT_PROTECT, WDT_WRWITE_MASK); + } + REG32_WRITE(RTC_WDT_FEED, (1 << RTC_CNTL_WDT_FEED)); + REG32_WRITE(RTC_WDT_PROTECT, 0); +} + +void IoTWatchDogEnable(void) +{ + WdtEnable(); +} + +void IoTWatchDogKick(void) +{ + WdtFeed(); +} + +void IoTWatchDogDisable(void) +{ + WdtDisable(); +} diff --git a/esp32_wrover_ie/liteos_m/components/fs/BUILD.gn b/esp32_wrover_ie/liteos_m/components/fs/BUILD.gn new file mode 100644 index 0000000..1594ad8 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/fs/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +config("public") { + include_dirs = [ "." ] +} + +hdf_driver("fs_adapter") { + sources = [ + "//utils/native/lite/file/src/file_impl_hal/file.c", + "fs_init.c", + "littlefs_hal.c", + ] + include_dirs = [ + ".", + "//utils/native/lite/hals/file", + "//utils/native/lite/include", + "//third_party/littlefs", + "//third_party/littlefs/bd", + "//device/soc/espressif/esp32/liteos_m/components/utils/include", + "//device/soc/espressif/esp32/liteos_m/sdk/rtos/liteos/liteos_m/libc", + ] + defines = [ "_GNU_SOURCE" ] +} diff --git a/esp32_wrover_ie/liteos_m/components/fs/fs_config.h b/esp32_wrover_ie/liteos_m/components/fs/fs_config.h new file mode 100644 index 0000000..ab4c903 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/fs/fs_config.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _FS_CONFIG_H +#define _FS_CONFIG_H + +#include "los_compiler.h" +#include "sys/socket.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +int *__errno_location(void); +#define errno (*__errno_location()) +#define LFS_NO_ASSERT 1 +#define FF_VOLUME_STRS "system", "inner", "update", "user" +#define FS_MAX_SS 512 + +#define FAT_MAX_OPEN_FILES 50 +#define LITTLEFS_MAX_LFN_LEN 120 + +#define O_SEARCH O_PATH +#define O_EXEC O_PATH +#define O_TTY_INIT 0 +#define ELIBBAD 80 + +#define O_ACCMODE (03|O_SEARCH) +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 040000 +#define O_NOFOLLOW 0100000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 0200000 +#define O_LARGEFILE 0400000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020040000 + +#define _FNDELAY O_NONBLOCK + +#define F_OFD_GETLK 36 +#define F_OFD_SETLK 37 +#define F_OFD_SETLKW 38 + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 + +#define F_DUPFD_CLOEXEC 1030 + +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +#define FD_CLOEXEC 1 + +#define AT_FDCWD (-100) +#define AT_SYMLINK_NOFOLLOW 0x100 +#define AT_REMOVEDIR 0x200 +#define AT_SYMLINK_FOLLOW 0x400 +#define AT_EACCESS 0x200 + +#define POSIX_FADV_NORMAL 0 +#define POSIX_FADV_RANDOM 1 +#define POSIX_FADV_SEQUENTIAL 2 +#define POSIX_FADV_WILLNEED 3 +#ifndef POSIX_FADV_DONTNEED +#define POSIX_FADV_DONTNEED 4 +#define POSIX_FADV_NOREUSE 5 +#endif + +#undef SEEK_SET +#undef SEEK_CUR +#undef SEEK_END +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define AT_NO_AUTOMOUNT 0x800 +#define AT_EMPTY_PATH 0x1000 +#define AT_STATX_SYNC_TYPE 0x6000 +#define AT_STATX_SYNC_AS_STAT 0x0000 +#define AT_STATX_FORCE_SYNC 0x2000 +#define AT_STATX_DONT_SYNC 0x4000 +#define AT_RECURSIVE 0x8000 + +#define FAPPEND O_APPEND +#define FFSYNC O_SYNC +#define FASYNC O_ASYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY + +#define F_OK 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 + +#define F_SETLEASE 1024 +#define F_GETLEASE 1025 +#define F_NOTIFY 1026 +#define F_CANCELLK 1029 +#define F_SETPIPE_SZ 1031 +#define F_GETPIPE_SZ 1032 +#define F_ADD_SEALS 1033 +#define F_GET_SEALS 1034 + +#define F_SEAL_SEAL 0x0001 +#define F_SEAL_SHRINK 0x0002 +#define F_SEAL_GROW 0x0004 +#define F_SEAL_WRITE 0x0008 +#define F_SEAL_FUTURE_WRITE 0x0010 + +#define F_GET_RW_HINT 1035 +#define F_SET_RW_HINT 1036 +#define F_GET_FILE_RW_HINT 1037 +#define F_SET_FILE_RW_HINT 1038 + +#define RWF_WRITE_LIFE_NOT_SET 0 +#define RWH_WRITE_LIFE_NONE 1 +#define RWH_WRITE_LIFE_SHORT 2 +#define RWH_WRITE_LIFE_MEDIUM 3 +#define RWH_WRITE_LIFE_LONG 4 +#define RWH_WRITE_LIFE_EXTREME 5 + +#define DN_ACCESS 0x00000001 +#define DN_MODIFY 0x00000002 +#define DN_CREATE 0x00000004 +#define DN_DELETE 0x00000008 +#define DN_RENAME 0x00000010 +#define DN_ATTRIB 0x00000020 +#define DN_MULTISHOT 0x80000000 +#endif + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _FS_CONFIG_H */ diff --git a/esp32_wrover_ie/liteos_m/components/fs/fs_init.c b/esp32_wrover_ie/liteos_m/components/fs/fs_init.c new file mode 100644 index 0000000..63a9e32 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/fs/fs_init.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "fs_init.h" +#include "lfs.h" +#include "los_task.h" +#include "securec.h" +#include "utils_file.h" + + +#define FS_INIT_TASK_SIZE 0x1000 +#define FS_INIT_TASK_PRIORITY 2 + +static uint32_t g_taskId; + +static void FileSystemEntry(void) +{ + int ret; + struct lfs_config *littlefsConfig = LittlefsConfigGet(); + LittlefsDriverInit(0); + SetDefaultMountPath(0, "/littlefs"); + ret = mount(NULL, "/littlefs", "littlefs", 0, littlefsConfig); + if (ret != LOS_OK) { + printf("Littlefs init failed 0x%x.\n", ret); + return; + } + + ret = mkdir("/littlefs", 775); + if (ret != LOS_OK) { + printf("Mkdir failed 0x%x.\n", ret); + return; + } + printf("Littlefs init successed!\n"); +} + +void FileSystemInit(void) +{ + uint32_t ret; + TSK_INIT_PARAM_S taskInitParam; + + ret = memset_s(&taskInitParam, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S)); + if (ret != EOK) { + return; + } + + taskInitParam.usTaskPrio = FS_INIT_TASK_PRIORITY; + taskInitParam.pcName = "FileSystemTask"; + taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)FileSystemEntry; + taskInitParam.uwStackSize = FS_INIT_TASK_SIZE; + ret = LOS_TaskCreate(&g_taskId, &taskInitParam); + if (ret != LOS_OK) { + printf("Create filesystem init task failed.\n"); + } +} diff --git a/esp32_wrover_ie/liteos_m/components/fs/fs_init.h b/esp32_wrover_ie/liteos_m/components/fs/fs_init.h new file mode 100644 index 0000000..7914711 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/fs/fs_init.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _FS_INIT_H +#define _FS_INIT_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +struct diskio_drv* FatfsConfigGet(void); +struct lfs_config* LittlefsConfigGet(void); + +void FileSystemInit(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _FS_INIT_H */ diff --git a/esp32_wrover_ie/liteos_m/components/fs/littlefs_hal.c b/esp32_wrover_ie/liteos_m/components/fs/littlefs_hal.c new file mode 100644 index 0000000..78a58a8 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/fs/littlefs_hal.c @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "los_memory.h" +#include "lfs_rambd.h" +#include "lfs.h" + +#define READ_SIZE 16 +#define PROG_SIZE 16 +#define BLOCK_SIZE 256 +#define BLOCK_COUNT 128 +#define CACHE_SIZE 16 +#define LOOKAHEAD_SIZE 16 +#define BLOCK_CYCLES 500 + +static int LittlefsRead(const struct lfs_config *cfg, lfs_block_t block, + lfs_off_t off, void *buffer, lfs_size_t size) +{ + (void)lfs_rambd_read(cfg, block, off, buffer, size); + + return LFS_ERR_OK; +} + +static int LittlefsProg(const struct lfs_config *cfg, lfs_block_t block, + lfs_off_t off, const void *buffer, lfs_size_t size) +{ + (void)lfs_rambd_prog(cfg, block, off, buffer, size); + + return LFS_ERR_OK; +} + +static int LittlefsErase(const struct lfs_config *cfg, lfs_block_t block) +{ + (void)lfs_rambd_erase(cfg, block); + + return LFS_ERR_OK; +} + +static int LittlefsSync(const struct lfs_config *cfg) +{ + return LFS_ERR_OK; +} + +static struct lfs_config g_lfsConfig = { + // block device operations + .context = NULL, + .read = LittlefsRead, + .prog = LittlefsProg, + .erase = LittlefsErase, + .sync = LittlefsSync, + + // block device configuration + .read_size = READ_SIZE, + .prog_size = PROG_SIZE, + .block_size = BLOCK_SIZE, + .block_count = BLOCK_COUNT, + .cache_size = CACHE_SIZE, + .lookahead_size = LOOKAHEAD_SIZE, + .block_cycles = BLOCK_CYCLES, + .read_buffer = NULL, + .prog_buffer = NULL, + .lookahead_buffer = NULL +}; + +void LittlefsDriverInit(int needErase) +{ + lfs_rambd_t *bd = (lfs_rambd_t *)LOS_MemAlloc(m_aucSysMem0, sizeof(lfs_rambd_t)); + (void)memset_s(bd, sizeof(lfs_rambd_t), 0, sizeof(lfs_rambd_t)); + g_lfsConfig.context = bd; + (void)lfs_rambd_create(&g_lfsConfig); +} + +struct lfs_config* LittlefsConfigGet(void) +{ + return &g_lfsConfig; +} diff --git a/esp32_wrover_ie/liteos_m/components/utils/BUILD.gn b/esp32_wrover_ie/liteos_m/components/utils/BUILD.gn new file mode 100644 index 0000000..e4ae09d --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/utils/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//drivers/adapter/khdf/liteos_m/hdf.gni") + +config("public") { + include_dirs = [ "include" ] +} + +kernel_module("sys_adapter") { + sources = [ + "src/dprintf.c", + "src/swap.c", + ] + + include_dirs = [ "include" ] + + include_dirs += [ + "//device/soc/espressif/esp32/liteos_m/sdk/include/board", + "//device/soc/espressif/esp32/liteos_m/sdk/include/watchdog", + ] + defines = [ "_GNU_SOURCE" ] +} diff --git a/esp32_wrover_ie/liteos_m/components/utils/src/dprintf.c b/esp32_wrover_ie/liteos_m/components/utils/src/dprintf.c new file mode 100644 index 0000000..cc56a79 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/utils/src/dprintf.c @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "los_interrupt.h" + +#define PLACEHOLDER_OFFSET 2 +#define HEXADECIMAL_NUM 16 +#define DECIMALISM_NUM 10 +#define BOUNDARY_NUM 9 + +VOID UartPutc(CHAR c) +{ + (VOID)uart_tx_one_char(c); +} + +VOID MatchedOut(CHAR data, va_list *ap) +{ + CHAR c = 0; + UINT32 v, n; + UINT32 val[100]; + CHAR *s = NULL; + INT32 i = 0; + INT32 j = 0; + + switch (data) { + case 'c': + c = va_arg(*ap, UINT32); + UartPutc(c); + break; + case 's': + s = va_arg(*ap, CHAR*); + while (*s) { + UartPutc(*s++); + } + break; + case 'd': + v = va_arg(*ap, UINT32); + i = 0; + while (v) { + n = v % DECIMALISM_NUM; + val[i] = n; + v = v / DECIMALISM_NUM; + i++; + } + if (i == 0) { + UartPutc('0'); + } + for (j = i - 1; j >= 0; j--) { + UartPutc('0' + val[j]); + } + break; + case 'x': + v = va_arg(*ap, UINT32); + i = 0; + if (v == 0) { + val[i] = 0; + i++; + } + while (v) { + n = v % HEXADECIMAL_NUM; + val[i] = n; + v = v / HEXADECIMAL_NUM; + i++; + } + if (i == 0) { + UartPutc('0'); + } + for (j = i - 1; j >= 0; j--) { + if (val[j] > BOUNDARY_NUM) { + UartPutc('a' + val[j] - DECIMALISM_NUM); + } else { + UartPutc('0' + val[j]); + } + } + break; + case 'p': + v = va_arg(*ap, UINT32); + i = 0; + if (v == 0) { + val[i] = 0; + i++; + } + while (v) { + n = v % HEXADECIMAL_NUM; + val[i] = n; + v = v / HEXADECIMAL_NUM; + i++; + } + UartPutc('0'); + UartPutc('x'); + if (i == 0) { + UartPutc('0'); + } + for (j = i - 1; j >= 0; j--) { + if (val[j] > BOUNDARY_NUM) { + UartPutc('a' + val[j] - DECIMALISM_NUM); + } else { + UartPutc('0' + val[j]); + } + } + break; + default: + break; + } +} + +INT32 printf(const CHAR *fmt, ...) +{ + va_list ap; + (VOID)va_start(ap, fmt); + while (*fmt != '\0') { + switch (*fmt) { + case '%': + MatchedOut(fmt[1], &ap); + fmt += PLACEHOLDER_OFFSET; + break; + case '\n': + UartPutc('\r'); + UartPutc('\n'); + fmt++; + break; + case '\r': + UartPutc('\r'); + UartPutc('\n'); + fmt++; + break; + default: + UartPutc(*fmt); + fmt++; + break; + } + } + (VOID)va_end(ap); + return 0; +} diff --git a/esp32_wrover_ie/liteos_m/components/utils/src/swap.c b/esp32_wrover_ie/liteos_m/components/utils/src/swap.c new file mode 100644 index 0000000..9140f61 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/components/utils/src/swap.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +unsigned int __builtin_bswap32(unsigned int a) +{ + return (a & 0xff) << 24 + | (a & 0xff00) << 8 + | (a & 0xff0000) >> 8 + | (a & 0xff000000) >> 24; +} diff --git a/esp32_wrover_ie/liteos_m/hals/utils/file/BUILD.gn b/esp32_wrover_ie/liteos_m/hals/utils/file/BUILD.gn new file mode 100644 index 0000000..2e56ffb --- /dev/null +++ b/esp32_wrover_ie/liteos_m/hals/utils/file/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//build/lite/config/component/lite_component.gni") + +static_library("hal_file_static") { + sources = [ "src/hal_file.c" ] + + include_dirs = [ + "//utils/native/lite/hals/file", + "//kernel/liteos_m", + ] +} + diff --git a/esp32_wrover_ie/liteos_m/hals/utils/file/src/hal_file.c b/esp32_wrover_ie/liteos_m/hals/utils/file/src/hal_file.c new file mode 100644 index 0000000..79ad315 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/hals/utils/file/src/hal_file.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include "errno.h" +#include "fcntl.h" +#include "sys/stat.h" +#include "lfs.h" +#include "lfs_rambd.h" +#include "fs_config.h" + +int HalFileOpen(const char* path, int oflag, int mode) +{ + char tmpPath[LITTLEFS_MAX_LFN_LEN] = {0}; + (void)snprintf_s(tmpPath, LITTLEFS_MAX_LFN_LEN, LITTLEFS_MAX_LFN_LEN, "/littlefs/%s", path); + return open(tmpPath, oflag, mode); +} + +int HalFileClose(int fd) +{ + return close(fd); +} + +int HalFileRead(int fd, char *buf, unsigned int len) +{ + return read(fd, buf, len); +} + +int HalFileWrite(int fd, const char *buf, unsigned int len) +{ + return write(fd, buf,len); +} + +int HalFileDelete(const char *path) +{ + char tmpPath[LITTLEFS_MAX_LFN_LEN] = {0}; + (void)snprintf_s(tmpPath, LITTLEFS_MAX_LFN_LEN, LITTLEFS_MAX_LFN_LEN, "/littlefs/%s", path); + return unlink(tmpPath); +} + +int HalFileStat(const char *path, unsigned int *fileSize) +{ + char tmpPath[LITTLEFS_MAX_LFN_LEN] = {0}; + struct stat halStat ; + int ret = 0; + (void)snprintf_s(tmpPath, LITTLEFS_MAX_LFN_LEN, LITTLEFS_MAX_LFN_LEN, "/littlefs/%s", path); + ret = stat(tmpPath, &halStat); + *fileSize = halStat.st_size; + return ret; +} + +int HalFileSeek(int fd, int offset, unsigned int whence) +{ + return lseek(fd, (off_t)offset, whence); +} + diff --git a/esp32_wrover_ie/liteos_m/sdk/BUILD.gn b/esp32_wrover_ie/liteos_m/sdk/BUILD.gn new file mode 100644 index 0000000..dbcb037 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed 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. + +import("//kernel/liteos_m/liteos.gni") + +module_name = "sdk" + +kernel_module(module_name) { + sources = [ + "rtos/liteos/liteos_m/main.c", + "rtos/liteos/liteos_m/test/task_demo.c", + ] + include_dirs = [ + "rtos/liteos/liteos_m", + "rtos/liteos/liteos_m/test", + "//device/soc/espressif/esp32_wrover_ie/liteos_m/components/fs", + "//device/soc/espressif/esp32_wrover_ie/liteos_m/sdk/include/board", + "//device/soc/espressif/esp32_wrover_ie/liteos_m/sdk/include/watchdog", + "//kernel/liteos_m/include", + ] +} + +config("public") { + include_dirs = [ + "rtos/liteos/liteos_m", + "rtos/liteos/liteos_m/test", + ] + ldflags = [ + "-Wl,-T" + rebase_path("scripts/link/ESP32.ld"), + "-nostdlib", + ] + libs = [ "gcc" ] +} diff --git a/esp32_wrover_ie/liteos_m/sdk/include/board/soc.h b/esp32_wrover_ie/liteos_m/sdk/include/board/soc.h new file mode 100644 index 0000000..aa27595 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/include/board/soc.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + * + * Description: Provide a task example. + */ + +#ifndef _SOC_H +#define _SOC_H + +#include "los_compiler.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +extern CHAR _sbss; +extern CHAR _ebss; +extern CHAR __init_stack_e; + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _SOC_H */ diff --git a/esp32_wrover_ie/liteos_m/sdk/include/watchdog/hal_watchdog.h b/esp32_wrover_ie/liteos_m/sdk/include/watchdog/hal_watchdog.h new file mode 100644 index 0000000..57c8e6e --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/include/watchdog/hal_watchdog.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _HAL_WATCHDOG_H +#define _HAL_WATCHDOG_H + +#include "los_compiler.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#define WDT_WRWITE_MASK 0x50d83aa1 +#define RTC_CNTL 0x3ff48000 +#define RTC_WDT_PROTECT 0x3ff480a4 +#define RTC_WDT_CFG0 0x3ff4808c +#define RTC_WDT_FEED 0x3ff480a0 +#define TIMER_GROUP0 0x3ff5F000 +#define WDT_TIMER_GROUP0_CNTL 0x3ff5F048 +#define TIMER_GROUP1 0x3ff60000 +#define WDT_TIMER_GROUP1_CNTL 0x3ff60048 +#define RTC_CNTL_WDT_FEED (31) +#define RTC_CNTL_WDT_EN (31) +#define RTC_CNTL_WDT_STG0 (28) +#define RTC_CNTL_WDT_FLASHBOOT_MOD_EN (10) +#define RTC_CNTL_WDT_INT (1) +#define RTC_CNTL_WDT_CPU_RESET (2) +#define RTC_CNTL_WDT_SYS_RESET (3) +#define RTC_CNTL_WDT_RTC_RESET (4) +#define RTC_CNTL_WDT_SYS_RESET_MASK (7) +#define RTC_CNTL_WDT_SYS_RESET_LENGTH (11) + +#define REG32_READ(reg) (*(volatile UINT32*) (reg)) +#define REG32_WRITE(reg, value) (*(volatile UINT32*) (reg) = value) + +VOID WdtEnable(VOID); +VOID WdtDisable(VOID); +VOID WdtFeed(VOID); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _HAL_WATCHDOG_H */ diff --git a/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/main.c b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/main.c new file mode 100644 index 0000000..19b30fb --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/main.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "task_demo.h" +#include "los_task.h" +#include "los_interrupt.h" +#include "hal_watchdog.h" +#include "soc.h" +#include "fs_init.h" + +VOID BssClean(VOID) +{ + CHAR *p = &_sbss; + for (INT32 i = 0; i < &_ebss - &_sbss; i++){ + *(p + i) = 0; + } +} + +INT32 main(VOID) +{ + TaskSample(); + return 0; +} + +VOID MainThreadCreate(VOID) +{ + UINT32 ret; + UINT32 taskID; + TSK_INIT_PARAM_S stTask = {0}; + + stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)main; + stTask.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; + stTask.pcName = "main"; + stTask.usTaskPrio = 2; + ret = LOS_TaskCreate(&taskID, &stTask); + if (ret != LOS_OK) { + printf("Task1 create failed\n"); + } +} + +void board_main(void) +{ + UINT32 ret; + BssClean(); + WdtDisable(); + + __asm__ __volatile__("mov sp, %0" : : "r"(&__init_stack_e)); +#ifdef __FPU_PRESENT + __asm__ __volatile__("wsr %0, CPENABLE;rsync" : : "r"(1)); +#endif + ret = LOS_KernelInit(); + FileSystemInit(); + if (ret == LOS_OK) { + MainThreadCreate(); + (VOID)LOS_Start(); + } +} diff --git a/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/target_config.h b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/target_config.h new file mode 100644 index 0000000..c9c35c3 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/target_config.h @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _TARGET_CONFIG_H +#define _TARGET_CONFIG_H + +#include "los_compiler.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +/*============================================================================= + System clock module configuration +=============================================================================*/ +#define OS_SYS_CLOCK 80000000 +#define LOSCFG_BASE_CORE_TICK_PER_SECOND (1000UL) +#define LOSCFG_BASE_CORE_TICK_HW_TIME 0 +#define LOSCFG_BASE_CORE_TICK_WTIMER 1 +#define LOSCFG_BASE_CORE_TICK_RESPONSE_MAX 80000 + +/*============================================================================= + Hardware interrupt module configuration +=============================================================================*/ +#define LOSCFG_PLATFORM_HWI 1 +#define OS_TICK_INT_NUM 6 +#define LOSCFG_PLATFORM_HWI_LIMIT 32 +/*============================================================================= + Task module configuration +=============================================================================*/ +#define LOSCFG_BASE_CORE_TSK_LIMIT 24 +#define LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE (0x1000U) +#define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x2000U) +#define LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE (0x1000U) +#define LOSCFG_BASE_CORE_TIMESLICE 1 +#define LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT 20000 +#define LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO 15 +/*============================================================================= + Semaphore module configuration +=============================================================================*/ +#define LOSCFG_BASE_IPC_SEM 1 +#define LOSCFG_BASE_IPC_SEM_LIMIT 48 +/*============================================================================= + Mutex module configuration +=============================================================================*/ +#define LOSCFG_BASE_IPC_MUX 1 +#define LOSCFG_BASE_IPC_MUX_LIMIT 24 +/*============================================================================= + Queue module configuration +=============================================================================*/ +#define LOSCFG_BASE_IPC_QUEUE 1 +#define LOSCFG_BASE_IPC_QUEUE_LIMIT 24 +/*============================================================================= + Software timer module configuration +=============================================================================*/ +#define LOSCFG_BASE_CORE_SWTMR 1 +#define LOSCFG_BASE_CORE_SWTMR_ALIGN 1 +#define LOSCFG_BASE_CORE_SWTMR_LIMIT 48 +/*============================================================================= + Memory module configuration +=============================================================================*/ +extern UINTPTR __heap_start; +#define LOSCFG_SYS_HEAP_ADDR (CHAR *)(UINTPTR)(&__heap_start) +#define LOSCFG_SYS_EXTERNAL_HEAP 1 +#define LOSCFG_SYS_HEAP_SIZE 0x24000 +#define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK 0 +#define LOSCFG_BASE_MEM_NODE_SIZE_CHECK 1 +#define LOSCFG_MEM_MUL_POOL 1 +#define OS_SYS_MEM_NUM 20 +#define LOSCFG_KERNEL_MEM_SLAB 0 +/*============================================================================= + Exception module configuration +=============================================================================*/ +#define LOSCFG_PLATFORM_EXC 0 + +/*============================================================================= + TestSuite configuration +=============================================================================*/ +#define LOSCFG_TEST 0 + +#define LOSCFG_BACKTRACE_TYPE 4 +#define LOSCFG_KERNEL_PRINTF 1 +#define LOSCFG_KERNEL_PM 0 +#define LFS_NO_ASSERT 1 +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _TARGET_CONFIG_H */ diff --git a/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.c b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.c new file mode 100644 index 0000000..f88bbff --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Description: Provide a task example. + */ + +#include "task_demo.h" +#include "stdio.h" +#include "los_task.h" + +VOID TaskSampleEntry2(VOID) +{ + while (1) { + printf("TaskSampleEntry2 running...\n"); + (VOID)LOS_TaskDelay(2000); /* 2000 millisecond */ + } +} + +VOID TaskSampleEntry1(VOID) +{ + while (1) { + printf("TaskSampleEntry1 running...\n"); + (VOID)LOS_TaskDelay(2000); /* 2000 millisecond */ + } +} + +VOID TaskSample(VOID) +{ + UINT32 ret; + UINT32 taskID1; + UINT32 taskID2; + TSK_INIT_PARAM_S stTask = {0}; + + stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry1; + stTask.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; + stTask.pcName = "TaskSampleEntry1"; + stTask.usTaskPrio = 2; /* Os task priority is 2 */ + ret = LOS_TaskCreate(&taskID2, &stTask); + if (ret != LOS_OK) { + printf("Task1 create failed\n"); + } + + stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry2; + stTask.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; + stTask.pcName = "TaskSampleEntry2"; + stTask.usTaskPrio = 2; /* Os task priority is 2 */ + ret = LOS_TaskCreate(&taskID2, &stTask); + if (ret != LOS_OK) { + printf("Task2 create failed\n"); + } +} diff --git a/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.h b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.h new file mode 100644 index 0000000..db0e156 --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/rtos/liteos/liteos_m/test/task_demo.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + * + * Description: Provide a task example. + */ + +#ifndef _TASK_DEMO_H +#define _TASK_DEMO_H + +#include "los_compiler.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +VOID TaskSample(VOID); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _TASK_DEMO_H */ diff --git a/esp32_wrover_ie/liteos_m/sdk/scripts/link/ESP32.ld b/esp32_wrover_ie/liteos_m/sdk/scripts/link/ESP32.ld new file mode 100644 index 0000000..43149cf --- /dev/null +++ b/esp32_wrover_ie/liteos_m/sdk/scripts/link/ESP32.ld @@ -0,0 +1,330 @@ +/**************************************************************************** + * device/qemu/esp32/ESP32.ld + * + * 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. + * + ****************************************************************************/ + +MEMORY { + drom (r) : ORIGIN = 0x3f400010, LENGTH = 0x800000 + extmem (rwx) : ORIGIN = 0x3f800000, LENGTH = 0x400000 + dram (rw) : ORIGIN = 0x3ffb0000, LENGTH = 0x50000 + iram_0 (rx) : ORIGIN = 0x40080000, LENGTH = 0x20000 + iram_1 (rx) : ORIGIN = 0x400D0018, LENGTH = 0x330000 +} + +_eram = ORIGIN(dram) + LENGTH(dram); + +/* Default entry point: */ +ENTRY(board_main); + +SECTIONS +{ + /* Send .iram0 code to iram */ + + .iram0.vectors : + { + /* Vectors go to IRAM */ + + _init_start = ABSOLUTE(.); + + /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */ + . = 0x0; + KEEP(*(.WindowVectors.text)); + . = 0x180; + KEEP(*(.InterruptEntry2.text)); + . = 0x1c0; + KEEP(*(.InterruptEntry3.text)); + . = 0x200; + KEEP(*(.InterruptEntry4.text)); + . = 0x240; + KEEP(*(.InterruptEntry5.text)); + . = 0x280; + KEEP(*(.DebugExceptionHandler.text)); + . = 0x2c0; + KEEP(*(.NMIExceptionHandler.text)); + . = 0x300; + KEEP(*(.KernelExceptionHandler.text)); + . = 0x340; + KEEP(*(.UserExceptionHandler.text)); + . = 0x3C0; + KEEP(*(.DoubleExceptionHandler.text)); + . = 0x400; + *(.*_vector.literal) + + . = ALIGN (16); + *(.entry.text) + *(.init.literal) + *(.init) + _init_end = ABSOLUTE(.); + } > iram_0 + + .iram0.text : + { + /* Code marked as running out of IRAM */ + + _iram_text_start = ABSOLUTE(.); + *(.iram1 .iram1.*) + *librtc.a:(.literal .text .literal.* .text.*) + *libarch.a:esp32_spiflash.*(.literal .text .literal.* .text.*) + *(.wifirxiram .wifirxiram.*) + *(.wifi0iram .wifi0iram.*) + *(.wifislpiram .wifislpiram.*) + *(.wifislprxiram .wifislprxiram.*) + *(.phyiram .phyiram.*) + + _iram_text_end = ABSOLUTE(.); + + /* IRAM heap starts at the end of iram */ + + . = ALIGN (4); + _siramheap = ABSOLUTE(.); + } > iram_0 + + /* Shared RAM */ + + .dram0.bss (NOLOAD) : + { + /* .bss initialized on power-up */ + + . = ALIGN (8); + _sbss = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + KEEP (*(.bss)) + *(.bss.*) + *(.share.mem) + *(.gnu.linkonce.b.*) + *(COMMON) + *libarch.a:esp32_spiflash.*(.bss .bss.* COMMON) + . = ALIGN(8); + __init_stack_s = ABSOLUTE(.); + . += 0x1000; + __init_stack_e = ABSOLUTE(.); + _ebss = .; + . = ALIGN(8); + _ebss = ABSOLUTE(.); + } >dram + + .dram0.data : + { + /* .data initialized on power-up in ROMed configurations. */ + + _sdata = ABSOLUTE(.); + KEEP (*(.data)) + KEEP (*(.data.*)) + KEEP (*(.gnu.linkonce.d.*)) + KEEP (*(.data1)) + KEEP (*(.sdata)) + KEEP (*(.sdata.*)) + KEEP (*(.gnu.linkonce.s.*)) + KEEP (*(.sdata2)) + KEEP (*(.sdata2.*)) + KEEP (*(.gnu.linkonce.s2.*)) + KEEP (*(.jcr)) + *(.dram1 .dram1.*) + *libphy.a:(.rodata .rodata.*) + *libarch.a:esp32_spiflash.*(.rodata .rodata.*) + . = ALIGN(4); + _edata = ABSOLUTE(.); + + /* Heap starts at the end of .data */ + + __heap_start = ABSOLUTE(.); + . += 0x24000; + . = ALIGN(4); + __heap_end = ABSOLUTE(.); + } >dram + + /* External memory bss, from any global variable with EXT_RAM_ATTR attribute */ + + .extmem.bss (NOLOAD) : + { + _sbss_extmem = ABSOLUTE(.); + *(.extmem.bss .extmem.bss.*) + . = ALIGN(4); + _ebss_extmem = ABSOLUTE(.); + } > extmem + + .flash.rodata : + { + _srodata = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); + *(.xt_except_table) + *(.gcc_except_table) + *(.gcc_except_table.*) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + *(.eh_frame) + + . = (. + 3) & ~ 3; + + /* C++ constructor and destructor tables, properly ordered: */ + + _sinit = ABSOLUTE(.); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + _einit = ABSOLUTE(.); + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + + /* C++ exception handlers table: */ + + __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + _erodata = ABSOLUTE(.); + /* Literals are also RO data. */ + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + . = ALIGN(4); + } >drom + + .flash.text : + { + _stext = .; + __text_start = ABSOLUTE(.); + *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */ + *(.fini.literal) + *(.fini) + *(.gnu.version) + . = ALIGN(4); + __zinitcall_bsp_start = .; + KEEP (*(.zinitcall.bsp0.init)) + KEEP (*(.zinitcall.bsp1.init)) + KEEP (*(.zinitcall.bsp2.init)) + KEEP (*(.zinitcall.bsp3.init)) + KEEP (*(.zinitcall.bsp4.init)) + __zinitcall_bsp_end = .; + __zinitcall_device_start = .; + KEEP (*(.zinitcall.device0.init)) + KEEP (*(.zinitcall.device1.init)) + KEEP (*(.zinitcall.device2.init)) + KEEP (*(.zinitcall.device3.init)) + KEEP (*(.zinitcall.device4.init)) + __zinitcall_device_end = .; + __zinitcall_core_start = .; + KEEP (*(.zinitcall.core0.init)) + KEEP (*(.zinitcall.core1.init)) + KEEP (*(.zinitcall.core2.init)) + KEEP (*(.zinitcall.core3.init)) + KEEP (*(.zinitcall.core4.init)) + __zinitcall_core_end = .; + __zinitcall_sys_service_start = .; + KEEP (*(.zinitcall.sys.service0.init)) + KEEP (*(.zinitcall.sys.service1.init)) + KEEP (*(.zinitcall.sys.service2.init)) + KEEP (*(.zinitcall.sys.service3.init)) + KEEP (*(.zinitcall.sys.service4.init)) + __zinitcall_sys_service_end = .; + __zinitcall_sys_feature_start = .; + KEEP (*(.zinitcall.sys.feature0.init)) + KEEP (*(.zinitcall.sys.feature1.init)) + KEEP (*(.zinitcall.sys.feature2.init)) + KEEP (*(.zinitcall.sys.feature3.init)) + KEEP (*(.zinitcall.sys.feature4.init)) + __zinitcall_sys_feature_end = .; + __zinitcall_run_start = .; + KEEP (*(.zinitcall.run0.init)) + KEEP (*(.zinitcall.run1.init)) + KEEP (*(.zinitcall.run2.init)) + KEEP (*(.zinitcall.run3.init)) + KEEP (*(.zinitcall.run4.init)) + __zinitcall_run_end = .; + __zinitcall_app_service_start = .; + KEEP (*(.zinitcall.app.service0.init)) + KEEP (*(.zinitcall.app.service1.init)) + KEEP (*(.zinitcall.app.service2.init)) + KEEP (*(.zinitcall.app.service3.init)) + KEEP (*(.zinitcall.app.service4.init)) + __zinitcall_app_service_end = .; + __zinitcall_app_feature_start = .; + KEEP (*(.zinitcall.app.feature0.init)) + KEEP (*(.zinitcall.app.feature1.init)) + KEEP (*(.zinitcall.app.feature2.init)) + KEEP (*(.zinitcall.app.feature3.init)) + KEEP (*(.zinitcall.app.feature4.init)) + __zinitcall_app_feature_end = .; + __zinitcall_test_start = .; + KEEP (*(.zinitcall.test0.init)) + KEEP (*(.zinitcall.test1.init)) + KEEP (*(.zinitcall.test2.init)) + KEEP (*(.zinitcall.test3.init)) + KEEP (*(.zinitcall.test4.init)) + __zinitcall_test_end = .; + __zinitcall_exit_start = .; + KEEP (*(.zinitcall.exit0.init)) + KEEP (*(.zinitcall.exit1.init)) + KEEP (*(.zinitcall.exit2.init)) + KEEP (*(.zinitcall.exit3.init)) + KEEP (*(.zinitcall.exit4.init)) + __zinitcall_exit_end = .; + + __text_end = ABSOLUTE(.); + _etext = .; + } >iram_1 + +} + +PROVIDE ( uartAttach = 0x40008fd0 ); +PROVIDE ( uart_baudrate_detect = 0x40009034 ); +PROVIDE ( uart_buff_switch = 0x400093c0 ); +PROVIDE ( UartConnCheck = 0x40008738 ); +PROVIDE ( UartConnectProc = 0x40008a04 ); +PROVIDE ( UartDev = 0x3ffe019c ); +PROVIDE ( uart_div_modify = 0x400090cc ); +PROVIDE ( UartDwnLdProc = 0x40008ce8 ); +PROVIDE ( UartGetCmdLn = 0x40009564 ); +PROVIDE ( Uart_Init = 0x40009120 ); +PROVIDE ( UartRegReadProc = 0x40008a58 ); +PROVIDE ( UartRegWriteProc = 0x40008a14 ); +PROVIDE ( uart_rx_intr_handler = 0x40008f4c ); +PROVIDE ( uart_rx_one_char = 0x400092d0 ); +PROVIDE ( uart_rx_one_char_block = 0x400092a4 ); +PROVIDE ( uart_rx_readbuff = 0x40009394 ); +PROVIDE ( UartRxString = 0x400092fc ); +PROVIDE ( UartSetBaudProc = 0x40008aac ); +PROVIDE ( UartSpiAttachProc = 0x40008a6c ); +PROVIDE ( UartSpiReadProc = 0x40008a80 ); +PROVIDE ( uart_tx_flush = 0x40009258 ); +PROVIDE ( uart_tx_one_char = 0x40009200 ); +PROVIDE ( uart_tx_one_char2 = 0x4000922c ); +PROVIDE ( uart_tx_switch = 0x40009028 ); +PROVIDE ( uart_tx_wait_idle = 0x40009278 ); diff --git a/esp32_wrover_ie/pack_tools/bootloader.bin b/esp32_wrover_ie/pack_tools/bootloader.bin new file mode 100644 index 0000000000000000000000000000000000000000..d43cbbcf352f727ea3ada211d28357015549d5b4 GIT binary patch literal 26656 zcmb_^3qaIW_WyUD48vC)P>Fo(erIqH6m0+>Sh@^I_)gG7Gg}#85Q>+8sb$-IvBklx z0Br@c-_B61kBtrJWf>b#k+r(1)n;uLQIxekNO=t~^ZkF$cV>9_*x&EJzaMqx-tW2h zo_p@O=bn4+%kSjUTWm^|@h4`~pCpJ8V&p&x_?v?GbCZYCEr{6wO@KBgQ7$}(NNQeQ z5i|L2!);L!Ik$76`t&ePUwA8*oo7nt@=XOrSw&fSxm=McHQUUY3kvcIw8)&Jb{C1v zSvFiGKC2M9vU0a@YwlRWnN0=RJ2`W1Q9)k*POdO-TS1z6_Uzg2!trZXuewg9%W_Ox z%v@StZjmV~w~))(mR*#Uk9zfmT%mbO4u}=b=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