Skip to content

Commit e5787e3

Browse files
committed
feat(modem_sim): Modem simulator based on esp-at
1 parent 7cddc8c commit e5787e3

File tree

14 files changed

+799
-3
lines changed

14 files changed

+799
-3
lines changed

.github/workflows/modem__build-host-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
strategy:
4646
matrix:
4747
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "release-v5.3", "release-v5.4", "latest"]
48-
test: ["target", "target_ota", "target_iperf"]
48+
test: ["target", "target_ota", "target_iperf", "target_urc"]
4949

5050
runs-on: ubuntu-22.04
5151
container: espressif/idf:${{ matrix.idf_ver }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "modem_sim: build-tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled]
9+
10+
jobs:
11+
build_modem_sim:
12+
if: contains(github.event.pull_request.labels.*.name, 'modem_sim') || github.event_name == 'push'
13+
name: Build
14+
strategy:
15+
matrix:
16+
idf_ver: ["release-v5.4"]
17+
runs-on: ubuntu-22.04
18+
container: espressif/idf:${{ matrix.idf_ver }}
19+
steps:
20+
- name: Checkout esp-protocols
21+
uses: actions/checkout@v3
22+
- name: Build ESP-AT with IDF-${{ matrix.idf_ver }}
23+
shell: bash
24+
run: |
25+
cd common_components/modem_sim
26+
./install.sh
27+
source export.sh
28+
idf.py build

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ repos:
6161
- repo: local
6262
hooks:
6363
- id: commit message scopes
64-
name: "commit message must be scoped with: mdns, dns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls, lws"
65-
entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|dns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls|lws)\)\:)'
64+
name: "commit message must be scoped with: mdns, dns, modem, websocket, asio, mqtt_cxx, console, common, eppp, tls_cxx, mosq, sockutls, lws, modem_sim"
65+
entry: '\A(?!(feat|fix|ci|bump|test|docs|chore)\((mdns|dns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp|tls_cxx|mosq|sockutls|lws|modem_sim)\)\:)'
6666
language: pygrep
6767
args: [--multiline]
6868
stages: [commit-msg]

common_components/modem_sim/export.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
source $IDF_PATH/export.sh
4+
5+
export AT_CUSTOM_COMPONENTS="`pwd`/pppd_cmd"
6+
7+
cd modem_sim_esp32/esp-at
8+
9+
python -m pip install -r requirements.txt
10+
11+
python build.py reconfigure
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
3+
# Create directory "modem_sim_esp32", go inside it
4+
# Usage: ./install.sh [platform] [module]
5+
6+
SCRIPT_DIR=$(pwd)
7+
mkdir -p modem_sim_esp32
8+
cd modem_sim_esp32
9+
10+
# Shallow clone https://github.com/espressif/esp-at.git
11+
if [ ! -d "esp-at" ]; then
12+
git clone --depth 1 https://github.com/espressif/esp-at.git
13+
else
14+
echo "esp-at directory already exists, skipping clone."
15+
fi
16+
17+
cd esp-at
18+
19+
# Add esp-idf directory which is a symlink to the $IDF_PATH
20+
if [ -z "$IDF_PATH" ]; then
21+
echo "Error: IDF_PATH environment variable is not set"
22+
exit 1
23+
fi
24+
25+
if [ ! -L "esp-idf" ]; then
26+
ln -sf "$IDF_PATH" esp-idf
27+
else
28+
echo "esp-idf symlink already exists, skipping."
29+
fi
30+
31+
# Create "build" directory
32+
mkdir -p build
33+
34+
# Default values for platform and module
35+
platform="PLATFORM_ESP32"
36+
module="WROOM-32"
37+
38+
# Override defaults if parameters are provided
39+
if [ ! -z "$1" ]; then
40+
platform="$1"
41+
fi
42+
if [ ! -z "$2" ]; then
43+
module="$2"
44+
fi
45+
46+
# Create file "build/module_info.json" with content
47+
cat > build/module_info.json << EOF
48+
{
49+
"platform": "$platform",
50+
"module": "$module",
51+
"description": "4MB, Wi-Fi + BLE, OTA, TX:17 RX:16",
52+
"silence": 0
53+
}
54+
EOF
55+
56+
cp "$SCRIPT_DIR/sdkconfig.defaults" "module_config/module_esp32_default/sdkconfig.defaults"
57+
58+
echo "Installation completed successfully!"
59+
echo "Created modem_sim_esp32 directory with esp-at repository and configuration"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
file(GLOB_RECURSE srcs *.c)
3+
4+
set(includes "include")
5+
6+
# Add more required components you need here, separated by spaces
7+
set(require_components at freertos nvs_flash)
8+
9+
idf_component_register(
10+
SRCS ${srcs}
11+
INCLUDE_DIRS ${includes}
12+
REQUIRES ${require_components})
13+
14+
idf_component_set_property(${COMPONENT_NAME} WHOLE_ARCHIVE TRUE)

0 commit comments

Comments
 (0)