-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26e6a2c
commit 0f391ce
Showing
20 changed files
with
538 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// Copyright (c) 2014-2019 Cesanta Software Limited | ||
// 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. | ||
|
||
//go:generate go-bindata -pkg esp32s3 -nocompress -modtime 1 -mode 420 stub/stub.json | ||
|
||
package esp32s3 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/juju/errors" | ||
"github.com/mongoose-os/mos/cli/flash/esp" | ||
) | ||
|
||
const ( | ||
EFUSE_BASE = 0x60007000 | ||
) | ||
|
||
func GetChipDescr(rr esp.RegReader) (string, error) { | ||
efuse_rd_mac_spi_sys_3_reg, err := rr.ReadReg(EFUSE_BASE + 0x50) | ||
if err != nil { | ||
return "", errors.Annotatef(err, "failed to read eFuse reg") | ||
} | ||
chip_pkg := (efuse_rd_mac_spi_sys_3_reg >> 21) & 0x7 | ||
var chip_pkg_str string | ||
switch chip_pkg { | ||
case 0: | ||
chip_pkg_str = "ESP32-S3" | ||
default: | ||
chip_pkg_str = fmt.Sprintf("?(%d", chip_pkg) | ||
} | ||
chip_rev := (efuse_rd_mac_spi_sys_3_reg >> 18) & 0x7 | ||
return fmt.Sprintf("%s R%d", chip_pkg_str, chip_rev), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright (c) 2015 Cesanta Software Limited | ||
# All rights reserved | ||
# | ||
|
||
STUB ?= stub.json | ||
COMMON_STUB_DIR = ../../esp/stub | ||
SDK ?= docker.io/mgos/esp32-build:4.4.1-r2 | ||
LIBS ?= | ||
|
||
SRCS = $(LIBS) $(COMMON_STUB_DIR)/stub_flasher.c $(COMMON_STUB_DIR)/slip.c | ||
|
||
.PHONY: all | ||
|
||
all: $(STUB) | ||
|
||
$(STUB): $(SRCS) $(COMMON_STUB_DIR)/wrap_stub.py | ||
@echo " $(SRCS) -> $@" | ||
docker run --rm -i -v '$(CURDIR)/../..:/src' $(SDK) /bin/bash -c \ | ||
"cd /src/esp32s3/stub && \ | ||
xtensa-esp32s3-elf-gcc -std=c99 -Wall -Werror -Os -DESP32S3 \ | ||
-mtext-section-literals -mlongcalls -nostdlib -fno-builtin -ggdb \ | ||
-DCONFIG_IDF_TARGET_ESP32S3 -DCONFIG_IDF_TARGET_ARCH_XTENSA \ | ||
-I/src/esp32s3/stub \ | ||
-I/opt/Espressif/esp-idf/components/esp_common/include \ | ||
-I/opt/Espressif/esp-idf/components/esp_rom/include \ | ||
-I/opt/Espressif/esp-idf/components/soc/include \ | ||
-I/opt/Espressif/esp-idf/components/soc/esp32s3/include \ | ||
-I/opt/Espressif/esp-idf/components/spi_flash/include \ | ||
-I/opt/Espressif/esp-idf/components/xtensa/include \ | ||
-L/opt/Espressif/esp-idf \ | ||
-ffunction-sections -Wl,-static -Wl,--gc-sections \ | ||
-Tstub.ld -o /tmp/stub.elf $(SRCS) && \ | ||
$(COMMON_STUB_DIR)/wrap_stub.py --output=$@ /tmp/stub.elf" |
Oops, something went wrong.