From 9ed7ca39ea1620fe772bc07208a792649083e82a Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 16:34:25 +0700 Subject: try action --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/build.yml (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..2a643a871 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,12 @@ +name: TinyUSB CI + +on: [pull_request, push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: true -- cgit v1.3.1 From ae6e7fa9284519c9ee3d0b52faab5be532ea1709 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 16:39:23 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a643a871..912a13ae9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v1 with: submodules: true -- cgit v1.3.1 From 8e2cc9731923e55793715bb9eb3dd2ea2db72fbf Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 16:55:13 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 912a13ae9..debba866b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,25 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: Python + uses: actions/setup-python@v1 + with: + python-version: 3.5 + - name: Toolchains + run: | + sudo apt-get install -y gettext + pip install requests sh click setuptools awscli + wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + wget -O /tmp/riscv-toolchain.tgz https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-1.1/xpack-riscv-none-embed-gcc-8.3.0-1.1-linux-x64.tgz + tar -xzf /tmp/riscv-toolchain.tgz + export PATH=$PWD/xPacks/riscv-none-embed-gcc/8.3.0-1.1/bin:$PATH + - name: Versions + run: | + arm-none-eabi-gcc --version + riscv-none-embed-gcc --version + - name: Git clone + uses: actions/checkout@v1 with: submodules: true + - name: -- cgit v1.3.1 From 73906cb4958ad2f2dcb291636f05d39ed6d090d5 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 16:56:46 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index debba866b..2676415cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,4 +28,3 @@ jobs: uses: actions/checkout@v1 with: submodules: true - - name: -- cgit v1.3.1 From e5a5d146e1707bf00cadabd86bc0c9a832ee3b6b Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 17:05:57 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2676415cd..1c0534825 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,15 +11,17 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.5 + - name: Node.js + uses: actions/setup-node@v1.1.0 - name: Toolchains run: | + # Install XPM + npm install --global xpm + xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest sudo apt-get install -y gettext pip install requests sh click setuptools awscli wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - wget -O /tmp/riscv-toolchain.tgz https://github.com/xpack-dev-tools/riscv-none-embed-gcc-xpack/releases/download/v8.3.0-1.1/xpack-riscv-none-embed-gcc-8.3.0-1.1-linux-x64.tgz - tar -xzf /tmp/riscv-toolchain.tgz - export PATH=$PWD/xPacks/riscv-none-embed-gcc/8.3.0-1.1/bin:$PATH - name: Versions run: | arm-none-eabi-gcc --version -- cgit v1.3.1 From a005a74e3dbb6aa99ef06b1baac800eb76ebb49a Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 17:24:37 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c0534825..7a34228d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,13 +18,14 @@ jobs: # Install XPM npm install --global xpm xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - sudo apt-get install -y gettext - pip install requests sh click setuptools awscli - wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + export PATH=$PATH:`$HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` + # sudo apt-get install -y gettext + # pip install requests sh click setuptools awscli + # wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + # sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - name: Versions run: | - arm-none-eabi-gcc --version + #arm-none-eabi-gcc --version riscv-none-embed-gcc --version - name: Git clone uses: actions/checkout@v1 -- cgit v1.3.1 From 56f717bca1aa32ec33f855a69c5b1d80ec1c1fc5 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 18:01:14 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a34228d2..d0dbf3b67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,15 +17,15 @@ jobs: run: | # Install XPM npm install --global xpm + # Install ARM GCC + xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest + export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-embed-gcc/*/.content/bin` + # Install RISCV GCC xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - export PATH=$PATH:`$HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - # sudo apt-get install -y gettext - # pip install requests sh click setuptools awscli - # wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - # sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - name: Versions run: | - #arm-none-eabi-gcc --version + arm-none-eabi-gcc --version riscv-none-embed-gcc --version - name: Git clone uses: actions/checkout@v1 -- cgit v1.3.1 From ee3e2bcc91149171c4585b7e592e2e791e92e85d Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:07:22 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0dbf3b67..9c2d329ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,8 @@ jobs: # Install RISCV GCC xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` + arm-none-eabi-gcc --version + riscv-none-embed-gcc --version - name: Versions run: | arm-none-eabi-gcc --version -- cgit v1.3.1 From 22ec72cd4b295f733931d5d23d032e904d4b14b3 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:09:18 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c2d329ca..627d7256b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,7 @@ jobs: # Install RISCV GCC xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` + echo $PATH arm-none-eabi-gcc --version riscv-none-embed-gcc --version - name: Versions -- cgit v1.3.1 From 81592feca53d5c0d2ea191eddc07ac758627e547 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:11:43 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 627d7256b..cb1930e80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,15 +19,10 @@ jobs: npm install --global xpm # Install ARM GCC xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-embed-gcc/*/.content/bin` + export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` # Install RISCV GCC xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - echo $PATH - arm-none-eabi-gcc --version - riscv-none-embed-gcc --version - - name: Versions - run: | arm-none-eabi-gcc --version riscv-none-embed-gcc --version - name: Git clone -- cgit v1.3.1 From a4be3a3227861d40c9179cde209e16b52ea2c456 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:29:25 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb1930e80..ccb39f7d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,13 +7,15 @@ jobs: runs-on: ubuntu-latest steps: - - name: Python + - name: Setup Python uses: actions/setup-python@v1 with: python-version: 3.5 - - name: Node.js + - name: Setup Node.js uses: actions/setup-node@v1.1.0 - - name: Toolchains + - name: Setup Ruby + uses: actions/setup-ruby@v1.0.0 + - name: Install Toolchains run: | # Install XPM npm install --global xpm @@ -29,3 +31,10 @@ jobs: uses: actions/checkout@v1 with: submodules: true + - name: Unit Tests + run: | + # Install Ceedling + gem install ceedling + cd test + ceedling test:all + -- cgit v1.3.1 From 7590266ad71aacf46fc567d30dfab0079a5e03be Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:33:09 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccb39f7d2..fbb4dd85a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,4 +37,7 @@ jobs: gem install ceedling cd test ceedling test:all - + cd .. + - name: Build + run: | + python3 tools/build_all.py board_test -- cgit v1.3.1 From ce5ceea3c4dde6a9590d43ca80d18dad2a8b2554 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:38:39 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbb4dd85a..24506c165 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,4 +40,6 @@ jobs: cd .. - name: Build run: | + arm-none-eabi-gcc --version + riscv-none-embed-gcc --version python3 tools/build_all.py board_test -- cgit v1.3.1 From 424063afd14dadf52cf3019da7c695830d72a557 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:41:51 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24506c165..d8b3e56e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,16 +17,9 @@ jobs: uses: actions/setup-ruby@v1.0.0 - name: Install Toolchains run: | - # Install XPM npm install --global xpm - # Install ARM GCC xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` - # Install RISCV GCC xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - arm-none-eabi-gcc --version - riscv-none-embed-gcc --version - name: Git clone uses: actions/checkout@v1 with: @@ -40,6 +33,7 @@ jobs: cd .. - name: Build run: | + export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` arm-none-eabi-gcc --version riscv-none-embed-gcc --version python3 tools/build_all.py board_test -- cgit v1.3.1 From 6e4df81998399e86f18bb2db47e94b013f394846 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:49:54 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8b3e56e9..ff86e72cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,9 +21,13 @@ jobs: xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - name: Git clone - uses: actions/checkout@v1 - with: - submodules: true + uses: actions/checkout@v2 + - name: Checkout submodules + shell: bash + run: | + auth_header="$(git config --local --get http.https://github.com/.extraheader)" + git submodule sync --recursive + git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive - name: Unit Tests run: | # Install Ceedling -- cgit v1.3.1 From e74dd33945d66f8d685f416eb927a3dac86a510c Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:53:55 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff86e72cf..6f491808d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,23 +11,29 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.5 + - name: Setup Node.js uses: actions/setup-node@v1.1.0 + - name: Setup Ruby uses: actions/setup-ruby@v1.0.0 + - name: Install Toolchains run: | npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - - name: Git clone + + - name: Checkout TinyUSB uses: actions/checkout@v2 + - name: Checkout submodules shell: bash run: | auth_header="$(git config --local --get http.https://github.com/.extraheader)" git submodule sync --recursive git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive + - name: Unit Tests run: | # Install Ceedling @@ -35,6 +41,7 @@ jobs: cd test ceedling test:all cd .. + - name: Build run: | export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` -- cgit v1.3.1 From 72af007a1927d91a95b41aa86e28838ef9b57c21 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 20:58:37 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f491808d..2d4fdec38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,21 +3,34 @@ name: TinyUSB CI on: [pull_request, push] jobs: + unit-test: + runs-on: ubuntu-latest + steps: + - name: Setup Ruby + uses: actions/setup-ruby@v1.0.0 + + - name: Checkout TinyUSB + uses: actions/checkout@v2 + + - name: Unit Tests + run: | + # Install Ceedling + gem install ceedling + cd test + ceedling test:all + cd .. + build: - runs-on: ubuntu-latest - + runs-on: ubuntu-latest steps: - name: Setup Python uses: actions/setup-python@v1 with: python-version: 3.5 - + - name: Setup Node.js uses: actions/setup-node@v1.1.0 - - - name: Setup Ruby - uses: actions/setup-ruby@v1.0.0 - + - name: Install Toolchains run: | npm install --global xpm @@ -34,14 +47,6 @@ jobs: git submodule sync --recursive git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive - - name: Unit Tests - run: | - # Install Ceedling - gem install ceedling - cd test - ceedling test:all - cd .. - - name: Build run: | export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` -- cgit v1.3.1 From e14698028c86226e03e024a7d998e0a63e43516d Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 21:03:40 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d4fdec38..9dc8d999d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,11 @@ jobs: cd .. build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + example: ['board_test', 'cdc_msc', 'dfu_rt', 'hid_composite', 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'usbtmc', 'webusb_serial'] steps: - name: Setup Python uses: actions/setup-python@v1 -- cgit v1.3.1 From e4a0af5e5ec54e217674bb4c74d87868f401b642 Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 21:08:16 +0700 Subject: Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dc8d999d..75cd57d15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,4 +56,4 @@ jobs: export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` arm-none-eabi-gcc --version riscv-none-embed-gcc --version - python3 tools/build_all.py board_test + python3 tools/build_all.py ${{ matrix.example }} -- cgit v1.3.1 From 2b6b856d7c0ba51cb1b3c1467c33c7527fb8c47e Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Fri, 27 Dec 2019 21:12:53 +0700 Subject: wrap up actions --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75cd57d15..e0fdb93d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,6 @@ jobs: gem install ceedling cd test ceedling test:all - cd .. build: runs-on: ubuntu-latest @@ -40,6 +39,9 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest + export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` + arm-none-eabi-gcc --version + riscv-none-embed-gcc --version - name: Checkout TinyUSB uses: actions/checkout@v2 @@ -54,6 +56,4 @@ jobs: - name: Build run: | export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - arm-none-eabi-gcc --version - riscv-none-embed-gcc --version python3 tools/build_all.py ${{ matrix.example }} -- cgit v1.3.1 From 70abfe7f45358af324613fb14c0746ae38ecf67e Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 27 Dec 2019 21:39:44 +0700 Subject: use github actions for build badge --- .github/workflows/build.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0fdb93d1..82e9d5735 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: TinyUSB CI +name: Build on: [pull_request, push] diff --git a/README.md b/README.md index 798c10a5d..eccb7627d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![tinyUSB_240x100](https://user-images.githubusercontent.com/249515/62646655-f9393200-b978-11e9-9c53-484862f15503.png) -[![Build Status](https://travis-ci.org/hathach/tinyusb.svg?branch=master)](https://travis-ci.org/hathach/tinyusb) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Coverity](https://img.shields.io/coverity/scan/458.svg)](https://scan.coverity.com/projects/tinyusb) +[![Build Status](https://github.com/hathach/tinyusb/workflows/Build/badge.svg)](https://travis-ci.org/hathach/tinyusb) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Coverity](https://img.shields.io/coverity/scan/458.svg)](https://scan.coverity.com/projects/tinyusb) TinyUSB is an open-source cross-platform USB Host/Device stack for embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function. -- cgit v1.3.1 From 947e7b803a05365065e67f92a3b90898138577b0 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:03:25 +0700 Subject: more ci --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82e9d5735..6f0b9df90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,9 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` + echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" + echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin" + #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` arm-none-eabi-gcc --version riscv-none-embed-gcc --version @@ -54,6 +56,4 @@ jobs: git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive - name: Build - run: | - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - python3 tools/build_all.py ${{ matrix.example }} + run: python3 tools/build_all.py ${{ matrix.example }} -- cgit v1.3.1 From ac78f420329130231b42245dcc6c73e40ac100b0 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:05:33 +0700 Subject: ci --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f0b9df90..66f58830d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,8 +39,9 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" - echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin" + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + echo $PATH #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` arm-none-eabi-gcc --version riscv-none-embed-gcc --version -- cgit v1.3.1 From 1b8626025eebbb1f5919caabee684d9e7473aee6 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:35:12 +0700 Subject: ci --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66f58830d..ab9de7291 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" + echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" echo $PATH #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` -- cgit v1.3.1 From dc8a68c7c0176e6ba160f7bb26553ae9804c286b Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:36:25 +0700 Subject: ci --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab9de7291..947f8ad07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,7 @@ jobs: xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + echo "::set-env PATH=`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" echo $PATH #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` arm-none-eabi-gcc --version -- cgit v1.3.1 From ccbae7538ddf7961af310b71f30a99f30db2fd52 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:41:44 +0700 Subject: ci test --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 947f8ad07..1c58f58e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,13 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest + echo $PATH echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - echo "::set-env PATH=`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + + echo "::add-path::/thach_tinyusb/" + + echo "::set-env name=PATH::$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" echo $PATH #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` arm-none-eabi-gcc --version -- cgit v1.3.1 From 274488ec65b0e46e0bc773d52929665be5438dd7 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:45:44 +0700 Subject: more ci test --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c58f58e7..fbd4f6bba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,10 +40,14 @@ jobs: xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest echo $PATH + echo "::add-path::/thach_tinyusb/" + echo $PATH + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" + echo $PATH echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" + echo $PATH echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - - echo "::add-path::/thach_tinyusb/" + echo $PATH echo "::set-env name=PATH::$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" echo $PATH -- cgit v1.3.1 From f5cc48017a5c751ed66ff5d74c7f78ee81f9686a Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:49:38 +0700 Subject: more ci --- .github/workflows/build.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbd4f6bba..1b0865c04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,19 +42,21 @@ jobs: echo $PATH echo "::add-path::/thach_tinyusb/" echo $PATH - echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" - echo $PATH - echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" - echo $PATH - echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - echo $PATH + #echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" + #echo $PATH + #echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" + #echo $PATH + #echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + #echo $PATH - echo "::set-env name=PATH::$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - echo $PATH + #echo "::set-env name=PATH::$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + #echo $PATH #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - arm-none-eabi-gcc --version - riscv-none-embed-gcc --version - + #arm-none-eabi-gcc --version + #riscv-none-embed-gcc --version + - nane: test PATH + run: echo $PATH + - name: Checkout TinyUSB uses: actions/checkout@v2 -- cgit v1.3.1 From 4406e378ce81d3c817e6f3679c6ff4a8dd9f1531 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:52:15 +0700 Subject: ci typo --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b0865c04..4e563ed15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` #arm-none-eabi-gcc --version #riscv-none-embed-gcc --version - - nane: test PATH + - name: test PATH run: echo $PATH - name: Checkout TinyUSB -- cgit v1.3.1 From bfdc9a94f9a89922ede1f64eea96e4d63d3bd87a Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 15:55:18 +0700 Subject: test ci --- .github/workflows/build.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e563ed15..10961837d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,21 +39,10 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - echo $PATH echo "::add-path::/thach_tinyusb/" - echo $PATH - #echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" - #echo $PATH - #echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" - #echo $PATH + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" + echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" #echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - #echo $PATH - - #echo "::set-env name=PATH::$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - #echo $PATH - #export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - #arm-none-eabi-gcc --version - #riscv-none-embed-gcc --version - name: test PATH run: echo $PATH -- cgit v1.3.1 From 1bcf1217857fe5228669c01f8e78e5d411ee06a0 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 28 Dec 2019 16:11:10 +0700 Subject: ci use github ::add-path:: --- .github/workflows/build.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10961837d..6e71351a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,6 @@ jobs: steps: - name: Setup Python uses: actions/setup-python@v1 - with: - python-version: 3.5 - name: Setup Node.js uses: actions/setup-node@v1.1.0 @@ -39,12 +37,8 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - echo "::add-path::/thach_tinyusb/" echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" - echo "::add-path::$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin" - #echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - - name: test PATH - run: echo $PATH + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" - name: Checkout TinyUSB uses: actions/checkout@v2 -- cgit v1.3.1 From 8e04eafb8a71ac214cfcb8b5a19c2b9aa00c492b Mon Sep 17 00:00:00 2001 From: Ha Thach Date: Sat, 28 Dec 2019 16:24:32 +0700 Subject: more ci (#253) * more ci * ci * ci * ci * ci test * more ci test * more ci * ci typo * test ci * ci use github ::add-path:: --- .github/workflows/build.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82e9d5735..6e71351a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,6 @@ jobs: steps: - name: Setup Python uses: actions/setup-python@v1 - with: - python-version: 3.5 - name: Setup Node.js uses: actions/setup-node@v1.1.0 @@ -39,10 +37,9 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - arm-none-eabi-gcc --version - riscv-none-embed-gcc --version - + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" + echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + - name: Checkout TinyUSB uses: actions/checkout@v2 @@ -54,6 +51,4 @@ jobs: git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive - name: Build - run: | - export PATH=$PATH:`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`:`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` - python3 tools/build_all.py ${{ matrix.example }} + run: python3 tools/build_all.py ${{ matrix.example }} -- cgit v1.3.1 From 019d1b09c5fcaa601af6e0a2aba882031bcbd3c7 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 3 Jan 2020 17:11:22 +0700 Subject: try to trigger mynewt example --- .github/workflows/build.yml | 8 ++++++++ README.md | 2 +- tools/build_all.py | 10 ---------- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e71351a9..fbbea9e15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,3 +52,11 @@ jobs: - name: Build run: python3 tools/build_all.py ${{ matrix.example }} + + trigger-mynewt: + runs-on: ubuntu-latest + needs: build + steps: + - name: Trigger mynewt-tinyusb-example + - run: curl -XPOST -u "hathach:${{secrets.MYNEWT_EXAMPLE_TOKEN}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches --data '{"event_type": "build_application"}' + diff --git a/README.md b/README.md index eccb7627d..75d354004 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![tinyUSB_240x100](https://user-images.githubusercontent.com/249515/62646655-f9393200-b978-11e9-9c53-484862f15503.png) -[![Build Status](https://github.com/hathach/tinyusb/workflows/Build/badge.svg)](https://travis-ci.org/hathach/tinyusb) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Coverity](https://img.shields.io/coverity/scan/458.svg)](https://scan.coverity.com/projects/tinyusb) +[![Build Status](https://github.com/hathach/tinyusb/workflows/Build/badge.svg)](https://github.com/hathach/tinyusb/actions) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Coverity](https://img.shields.io/coverity/scan/458.svg)](https://scan.coverity.com/projects/tinyusb) TinyUSB is an open-source cross-platform USB Host/Device stack for embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function. diff --git a/tools/build_all.py b/tools/build_all.py index 2ea898f45..97294a9a3 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -4,10 +4,6 @@ import sys import subprocess import time -travis = False -if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true": - travis = True - success_count = 0 fail_count = 0 exit_status = 0 @@ -59,16 +55,10 @@ for example in all_examples: success = "\033[31mfailed\033[0m " fail_count += 1 - if travis: - print('travis_fold:start:build-{}-{}\\r'.format(example, board)) - print((build_format + '| {:.2f}s |').format(example, board, success, build_duration)) if build_result.returncode != 0: print(build_result.stdout.decode("utf-8")) - if travis: - print('travis_fold:end:build-{}-{}\\r'.format(example, board)) - # FreeRTOS example # example = 'cdc_msc_hid_freertos' # board = 'pca10056' -- cgit v1.3.1 From 2cbd0cdf5046201428b255c942ce760ac859d172 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 3 Jan 2020 17:19:23 +0700 Subject: change to token --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbbea9e15..f7dddfc86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,5 +58,5 @@ jobs: needs: build steps: - name: Trigger mynewt-tinyusb-example - - run: curl -XPOST -u "hathach:${{secrets.MYNEWT_EXAMPLE_TOKEN}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches --data '{"event_type": "build_application"}' + - run: curl -X POST -H "Authorization: token ${{ secrets.MYNEWT_EXAMPLE_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches --data '{"event_type": "build_application"}' -- cgit v1.3.1 From 4282a0d96aef028f0557de18aa022ea84829d155 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 3 Jan 2020 17:37:10 +0700 Subject: curl again --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7dddfc86..d27896f7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,5 +58,5 @@ jobs: needs: build steps: - name: Trigger mynewt-tinyusb-example - - run: curl -X POST -H "Authorization: token ${{ secrets.MYNEWT_EXAMPLE_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches --data '{"event_type": "build_application"}' - + shell: bash + run: curl -X POST -H "Authorization: token ${{ secrets.MYNEWT_EXAMPLE_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches -- cgit v1.3.1 From 6f03617ff56a4c057bbf846500f2c33cbe1d6d1d Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 4 Jan 2020 00:12:03 +0700 Subject: curl --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d27896f7d..1e41d6006 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,4 +59,5 @@ jobs: steps: - name: Trigger mynewt-tinyusb-example shell: bash - run: curl -X POST -H "Authorization: token ${{ secrets.MYNEWT_EXAMPLE_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches + run: | + curl -X POST -H "Authorization: token ${{ secrets.MYNEWT_EXAMPLE_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches -- cgit v1.3.1 From 3362a4b09dac481cc47ae54446026fa211c4d914 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 4 Jan 2020 14:24:21 +0700 Subject: change token name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e41d6006..2ac5b2ba0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,4 +60,4 @@ jobs: - name: Trigger mynewt-tinyusb-example shell: bash run: | - curl -X POST -H "Authorization: token ${{ secrets.MYNEWT_EXAMPLE_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches + curl -X POST -H "Authorization: token ${{ secrets.GH_REPO_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches -- cgit v1.3.1 From 03d14f4d832efc8a015c2b13e09cab7f4fa48079 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 9 Jan 2020 21:31:10 +0700 Subject: add trigger.yml --- .github/workflows/trigger.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/trigger.yml (limited to '.github') diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml new file mode 100644 index 000000000..a7ef1341d --- /dev/null +++ b/.github/workflows/trigger.yml @@ -0,0 +1,14 @@ +name: Trigger Repos + +on: + push: + branches: master + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - name: mynewt-tinyusb-example + shell: bash + run: | + curl -X POST -H "Authorization: token ${{ secrets.GH_REPO_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches -- cgit v1.3.1 From 516e6e6bea047d28e6a286aa0285b238859ecd61 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 11 Jan 2020 13:02:10 +0700 Subject: add cdc_dual_ports example to actionci --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fc11f3dd..729222512 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,8 @@ jobs: strategy: fail-fast: false matrix: - example: ['board_test', 'cdc_msc', 'dfu_rt', 'hid_composite', 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'usbtmc', 'webusb_serial'] + example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'dfu_rt', 'hid_composite', + 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'usbtmc', 'webusb_serial'] steps: - name: Setup Python uses: actions/setup-python@v1 -- cgit v1.3.1 From 6e6b929f8e3ccc2d53e11be5283cb294dbcc6877 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 9 Mar 2020 15:54:16 +0700 Subject: add net_webserver into ci build --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 729222512..d1e3b8993 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,8 @@ jobs: strategy: fail-fast: false matrix: - example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'dfu_rt', 'hid_composite', - 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'usbtmc', 'webusb_serial'] + example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'dfu_rt', 'hid_composite', 'hid_generic_inout', + 'midi_test', 'msc_dual_lun', 'net_webserver', 'usbtmc', 'webusb_serial'] steps: - name: Setup Python uses: actions/setup-python@v1 -- cgit v1.3.1 From 8a8f84cd3708781a4b2031a76b1f12dbde5d006c Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 9 Mar 2020 23:05:22 +0700 Subject: more rename --- .github/workflows/build.yml | 2 +- .../device/net_lwip_webserver/.skip.MCU_LPC11UXX | 0 .../device/net_lwip_webserver/.skip.MCU_LPC13XX | 0 .../device/net_lwip_webserver/.skip.MCU_NUC121 | 0 .../device/net_lwip_webserver/.skip.MCU_STM32L0 | 0 examples/device/net_lwip_webserver/Makefile | 57 ++++++ examples/device/net_lwip_webserver/src/arch/cc.h | 75 ++++++++ examples/device/net_lwip_webserver/src/lwipopts.h | 57 ++++++ examples/device/net_lwip_webserver/src/main.c | 214 +++++++++++++++++++++ .../device/net_lwip_webserver/src/tusb_config.h | 90 +++++++++ .../net_lwip_webserver/src/usb_descriptors.c | 199 +++++++++++++++++++ .../net_lwip_webserver/src/usb_descriptors.h | 28 +++ examples/device/net_webserver/.skip.MCU_LPC11UXX | 0 examples/device/net_webserver/.skip.MCU_LPC13XX | 0 examples/device/net_webserver/.skip.MCU_NUC121 | 0 examples/device/net_webserver/.skip.MCU_STM32L0 | 0 examples/device/net_webserver/Makefile | 57 ------ examples/device/net_webserver/src/arch/cc.h | 75 -------- examples/device/net_webserver/src/lwipopts.h | 57 ------ examples/device/net_webserver/src/main.c | 214 --------------------- examples/device/net_webserver/src/tusb_config.h | 90 --------- .../device/net_webserver/src/usb_descriptors.c | 199 ------------------- .../device/net_webserver/src/usb_descriptors.h | 28 --- 23 files changed, 721 insertions(+), 721 deletions(-) create mode 100644 examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX create mode 100644 examples/device/net_lwip_webserver/.skip.MCU_LPC13XX create mode 100644 examples/device/net_lwip_webserver/.skip.MCU_NUC121 create mode 100644 examples/device/net_lwip_webserver/.skip.MCU_STM32L0 create mode 100644 examples/device/net_lwip_webserver/Makefile create mode 100644 examples/device/net_lwip_webserver/src/arch/cc.h create mode 100644 examples/device/net_lwip_webserver/src/lwipopts.h create mode 100644 examples/device/net_lwip_webserver/src/main.c create mode 100644 examples/device/net_lwip_webserver/src/tusb_config.h create mode 100644 examples/device/net_lwip_webserver/src/usb_descriptors.c create mode 100644 examples/device/net_lwip_webserver/src/usb_descriptors.h delete mode 100644 examples/device/net_webserver/.skip.MCU_LPC11UXX delete mode 100644 examples/device/net_webserver/.skip.MCU_LPC13XX delete mode 100644 examples/device/net_webserver/.skip.MCU_NUC121 delete mode 100644 examples/device/net_webserver/.skip.MCU_STM32L0 delete mode 100644 examples/device/net_webserver/Makefile delete mode 100644 examples/device/net_webserver/src/arch/cc.h delete mode 100644 examples/device/net_webserver/src/lwipopts.h delete mode 100644 examples/device/net_webserver/src/main.c delete mode 100644 examples/device/net_webserver/src/tusb_config.h delete mode 100644 examples/device/net_webserver/src/usb_descriptors.c delete mode 100644 examples/device/net_webserver/src/usb_descriptors.h (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1e3b8993..54d4babac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'dfu_rt', 'hid_composite', 'hid_generic_inout', - 'midi_test', 'msc_dual_lun', 'net_webserver', 'usbtmc', 'webusb_serial'] + 'midi_test', 'msc_dual_lun', 'net_lwip_webserver', 'usbtmc', 'webusb_serial'] steps: - name: Setup Python uses: actions/setup-python@v1 diff --git a/examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX b/examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX new file mode 100644 index 000000000..e69de29bb diff --git a/examples/device/net_lwip_webserver/.skip.MCU_LPC13XX b/examples/device/net_lwip_webserver/.skip.MCU_LPC13XX new file mode 100644 index 000000000..e69de29bb diff --git a/examples/device/net_lwip_webserver/.skip.MCU_NUC121 b/examples/device/net_lwip_webserver/.skip.MCU_NUC121 new file mode 100644 index 000000000..e69de29bb diff --git a/examples/device/net_lwip_webserver/.skip.MCU_STM32L0 b/examples/device/net_lwip_webserver/.skip.MCU_STM32L0 new file mode 100644 index 000000000..e69de29bb diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile new file mode 100644 index 000000000..a153c30be --- /dev/null +++ b/examples/device/net_lwip_webserver/Makefile @@ -0,0 +1,57 @@ +include ../../../tools/top.mk +include ../../make.mk + +CFLAGS += \ + -DPBUF_POOL_SIZE=2 \ + -DTCP_WND=2*TCP_MSS \ + -DHTTPD_USE_CUSTOM_FSDATA=0 + +INC += \ + src \ + $(TOP)/hw \ + $(TOP)/lib/lwip/src/include \ + $(TOP)/lib/lwip/src/include/ipv4 \ + $(TOP)/lib/lwip/src/include/lwip/apps \ + $(TOP)/lib/networking + +# Example source +EXAMPLE_SOURCE += $(wildcard src/*.c) +SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE)) +SRC_C += \ + lib/lwip/src/core/altcp.c \ + lib/lwip/src/core/altcp_alloc.c \ + lib/lwip/src/core/altcp_tcp.c \ + lib/lwip/src/core/def.c \ + lib/lwip/src/core/dns.c \ + lib/lwip/src/core/inet_chksum.c \ + lib/lwip/src/core/init.c \ + lib/lwip/src/core/ip.c \ + lib/lwip/src/core/mem.c \ + lib/lwip/src/core/memp.c \ + lib/lwip/src/core/netif.c \ + lib/lwip/src/core/pbuf.c \ + lib/lwip/src/core/raw.c \ + lib/lwip/src/core/stats.c \ + lib/lwip/src/core/sys.c \ + lib/lwip/src/core/tcp.c \ + lib/lwip/src/core/tcp_in.c \ + lib/lwip/src/core/tcp_out.c \ + lib/lwip/src/core/timeouts.c \ + lib/lwip/src/core/udp.c \ + lib/lwip/src/core/ipv4/autoip.c \ + lib/lwip/src/core/ipv4/dhcp.c \ + lib/lwip/src/core/ipv4/etharp.c \ + lib/lwip/src/core/ipv4/icmp.c \ + lib/lwip/src/core/ipv4/igmp.c \ + lib/lwip/src/core/ipv4/ip4.c \ + lib/lwip/src/core/ipv4/ip4_addr.c \ + lib/lwip/src/core/ipv4/ip4_frag.c \ + lib/lwip/src/netif/ethernet.c \ + lib/lwip/src/netif/slipif.c \ + lib/lwip/src/apps/http/httpd.c \ + lib/lwip/src/apps/http/fs.c \ + lib/networking/dhserver.c \ + lib/networking/dnserver.c \ + lib/networking/rndis_reports.c + +include ../../rules.mk diff --git a/examples/device/net_lwip_webserver/src/arch/cc.h b/examples/device/net_lwip_webserver/src/arch/cc.h new file mode 100644 index 000000000..56a0cacf7 --- /dev/null +++ b/examples/device/net_lwip_webserver/src/arch/cc.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2001-2003 Swedish Institute of Computer Science. + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __CC_H__ +#define __CC_H__ + +//#include "cpu.h" + +typedef int sys_prot_t; + + + +/* define compiler specific symbols */ +#if defined (__ICCARM__) + +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_STRUCT +#define PACK_STRUCT_END +#define PACK_STRUCT_FIELD(x) x +#define PACK_STRUCT_USE_INCLUDES + +#elif defined (__CC_ARM) + +#define PACK_STRUCT_BEGIN __packed +#define PACK_STRUCT_STRUCT +#define PACK_STRUCT_END +#define PACK_STRUCT_FIELD(x) x + +#elif defined (__GNUC__) + +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) +#define PACK_STRUCT_END +#define PACK_STRUCT_FIELD(x) x + +#elif defined (__TASKING__) + +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_STRUCT +#define PACK_STRUCT_END +#define PACK_STRUCT_FIELD(x) x + +#endif + +#define LWIP_PLATFORM_ASSERT(x) do { if(!(x)) while(1); } while(0) + +#endif /* __CC_H__ */ diff --git a/examples/device/net_lwip_webserver/src/lwipopts.h b/examples/device/net_lwip_webserver/src/lwipopts.h new file mode 100644 index 000000000..23319592d --- /dev/null +++ b/examples/device/net_lwip_webserver/src/lwipopts.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2001-2003 Swedish Institute of Computer Science. + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Simon Goldschmidt + * + */ +#ifndef __LWIPOPTS_H__ +#define __LWIPOPTS_H__ + +/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ +#define NO_SYS 1 +#define MEM_ALIGNMENT 4 +#define LWIP_RAW 1 +#define LWIP_NETCONN 0 +#define LWIP_SOCKET 0 +#define LWIP_DHCP 0 +#define LWIP_ICMP 1 +#define LWIP_UDP 1 +#define LWIP_TCP 1 +#define ETH_PAD_SIZE 0 +#define LWIP_IP_ACCEPT_UDP_PORT(p) ((p) == PP_NTOHS(67)) + +#define TCP_MSS (1500 /*mtu*/ - 20 /*iphdr*/ - 20 /*tcphhr*/) +#define TCP_SND_BUF (2 * TCP_MSS) + +#define ETHARP_SUPPORT_STATIC_ENTRIES 1 + +#define LWIP_HTTPD_CGI 0 +#define LWIP_HTTPD_SSI 0 +#define LWIP_HTTPD_SSI_INCLUDE_TAG 0 + +#endif /* __LWIPOPTS_H__ */ diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c new file mode 100644 index 000000000..c193aeb0f --- /dev/null +++ b/examples/device/net_lwip_webserver/src/main.c @@ -0,0 +1,214 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2020 Peter Lawrence + * + * influenced by lrndis https://github.com/fetisov/lrndis + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +/* +depending on the value of CFG_TUD_NET (tusb_config.h), this can be a CDC-ECM, RNDIS, or CDC-EEM USB virtual network adapter + +CDC-ECM should be valid on Linux and MacOS hosts +RNDIS should be valid on Linux and Windows hosts +CDC-EEM should be valid on Linux hosts + +You *must* customize tusb_config.h to set the CFG_TUD_NET definition to the type of these network adapters to emulate. + +The MCU appears to the host as IP address 192.168.7.1, and provides a DHCP server, DNS server, and web server. +*/ + +#include "bsp/board.h" +#include "tusb.h" + +#include "dhserver.h" +#include "dnserver.h" +#include "lwip/init.h" +#include "httpd.h" + +/* lwip context */ +static struct netif netif_data; + +/* shared between tud_network_recv_cb() and service_traffic() */ +static struct pbuf *received_frame; + +/* this is used by this code, ./class/net/net_driver.c, and usb_descriptors.c */ +/* ideally speaking, this should be generated from the hardware's unique ID (if available) */ +const uint8_t tud_network_mac_address[6] = {0x20,0x89,0x84,0x6A,0x96,0x00}; + +/* network parameters of this MCU */ +static const ip_addr_t ipaddr = IPADDR4_INIT_BYTES(192, 168, 7, 1); +static const ip_addr_t netmask = IPADDR4_INIT_BYTES(255, 255, 255, 0); +static const ip_addr_t gateway = IPADDR4_INIT_BYTES(0, 0, 0, 0); + +/* database IP addresses that can be offered to the host; this must be in RAM to store assigned MAC addresses */ +static dhcp_entry_t entries[] = +{ + /* mac ip address subnet mask lease time */ + { {0}, {192, 168, 7, 2}, {255, 255, 255, 0}, 24 * 60 * 60 }, + { {0}, {192, 168, 7, 3}, {255, 255, 255, 0}, 24 * 60 * 60 }, + { {0}, {192, 168, 7, 4}, {255, 255, 255, 0}, 24 * 60 * 60 } +}; + +/* DHCP configuration parameters, leveraging "entries" above */ +static const dhcp_config_t dhcp_config = +{ + {192, 168, 7, 1}, 67, /* server address (self), port */ + {192, 168, 7, 1}, /* dns server (self) */ + "usb", /* dns suffix */ + TU_ARRAY_SIZE(entries), /* number of entries */ + entries /* pointer to entries */ +}; + +static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) +{ + (void)netif; + + for (;;) + { + /* if TinyUSB isn't ready, we must signal back to lwip that there is nothing we can do */ + if (!tud_ready()) + return ERR_USE; + + /* if the network driver can accept another packet, we make it happen */ + if (tud_network_can_xmit()) + { + tud_network_xmit(p); + return ERR_OK; + } + + /* transfer execution to TinyUSB in the hopes that it will finish transmitting the prior packet */ + tud_task(); + } +} + +static err_t output_fn(struct netif *netif, struct pbuf *p, const ip_addr_t *addr) +{ + return etharp_output(netif, p, addr); +} + +static err_t netif_init_cb(struct netif *netif) +{ + LWIP_ASSERT("netif != NULL", (netif != NULL)); + netif->mtu = CFG_TUD_NET_MTU; + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP; + netif->state = NULL; + netif->name[0] = 'E'; + netif->name[1] = 'X'; + netif->linkoutput = linkoutput_fn; + netif->output = output_fn; + return ERR_OK; +} + +static void init_lwip(void) +{ + struct netif *netif = &netif_data; + + lwip_init(); + netif->hwaddr_len = sizeof(tud_network_mac_address); + memcpy(netif->hwaddr, tud_network_mac_address, sizeof(tud_network_mac_address)); + + netif = netif_add(netif, &ipaddr, &netmask, &gateway, NULL, netif_init_cb, ip_input); + netif_set_default(netif); +} + +/* handle any DNS requests from dns-server */ +bool dns_query_proc(const char *name, ip_addr_t *addr) +{ + if (0 == strcmp(name, "tiny.usb")) + { + *addr = ipaddr; + return true; + } + return false; +} + +bool tud_network_recv_cb(struct pbuf *p) +{ + /* this shouldn't happen, but if we get another packet before + parsing the previous, we must signal our inability to accept it */ + if (received_frame) return false; + + /* store away the pointer for service_traffic() to later handle */ + received_frame = p; + return true; +} + +static void service_traffic(void) +{ + /* handle any packet received by tud_network_recv_cb() */ + if (received_frame) + { + ethernet_input(received_frame, &netif_data); + pbuf_free(received_frame); + received_frame = NULL; + tud_network_recv_renew(); + } +} + +void tud_network_init_cb(void) +{ + /* if the network is re-initializing and we have a leftover packet, we must do a cleanup */ + if (received_frame) + { + pbuf_free(received_frame); + received_frame = NULL; + } +} + +int main(void) +{ + /* initialize TinyUSB */ + board_init(); + tusb_init(); + + /* initialize lwip, dhcp-server, dns-server, and http */ + init_lwip(); + while (!netif_is_up(&netif_data)); + while (dhserv_init(&dhcp_config) != ERR_OK); + while (dnserv_init(&ipaddr, 53, dns_query_proc) != ERR_OK); + httpd_init(); + + while (1) + { + tud_task(); + service_traffic(); + } + + return 0; +} + +/* lwip has provision for using a mutex, when applicable */ +sys_prot_t sys_arch_protect(void) +{ + return 0; +} +void sys_arch_unprotect(sys_prot_t pval) +{ + (void)pval; +} + +/* lwip needs a millisecond time source, and the TinyUSB board support code has one available */ +uint32_t sys_now(void) +{ + return board_millis(); +} diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h new file mode 100644 index 000000000..329fc80b9 --- /dev/null +++ b/examples/device/net_lwip_webserver/src/tusb_config.h @@ -0,0 +1,90 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#ifndef _TUSB_CONFIG_H_ +#define _TUSB_CONFIG_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +//-------------------------------------------------------------------- +// COMMON CONFIGURATION +//-------------------------------------------------------------------- + +// defined by compiler flags for flexibility +#ifndef CFG_TUSB_MCU + #error CFG_TUSB_MCU must be defined +#endif + +#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX +#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) +#else +#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE +#endif + +#define CFG_TUSB_OS OPT_OS_NONE + +// CFG_TUSB_DEBUG is defined by compiler in DEBUG build +// #define CFG_TUSB_DEBUG 0 + +/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. + * Tinyusb use follows macros to declare transferring memory so that they can be put + * into those specific section. + * e.g + * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) + * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) + */ +#ifndef CFG_TUSB_MEM_SECTION +#define CFG_TUSB_MEM_SECTION +#endif + +#ifndef CFG_TUSB_MEM_ALIGN +#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) +#endif + +//-------------------------------------------------------------------- +// DEVICE CONFIGURATION +//-------------------------------------------------------------------- + +#ifndef CFG_TUD_ENDPOINT0_SIZE +#define CFG_TUD_ENDPOINT0_SIZE 64 +#endif + +//------------- CLASS -------------// +#define CFG_TUD_CDC 0 +#define CFG_TUD_MSC 0 +#define CFG_TUD_HID 0 +#define CFG_TUD_MIDI 0 +#define CFG_TUD_VENDOR 0 +//#define CFG_TUD_NET OPT_NET_ECM +#define CFG_TUD_NET OPT_NET_RNDIS +//#define CFG_TUD_NET OPT_NET_EEM + +#ifdef __cplusplus + } +#endif + +#endif /* _TUSB_CONFIG_H_ */ diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c new file mode 100644 index 000000000..26f8aeba6 --- /dev/null +++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c @@ -0,0 +1,199 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#include "tusb.h" +#include "usb_descriptors.h" + +/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug. + * Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC. + * + * Auto ProductID layout's Bitmap: + * [MSB] NET1:NET0 | VENDOR | MIDI | HID | MSC | CDC [LSB] + */ +#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) ) +#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \ + _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) | _PID_MAP(NET, 5) ) + +//--------------------------------------------------------------------+ +// Device Descriptors +//--------------------------------------------------------------------+ +tusb_desc_device_t const desc_device = +{ + .bLength = sizeof(tusb_desc_device_t), + .bDescriptorType = TUSB_DESC_DEVICE, + .bcdUSB = 0x0200, + + .bDeviceClass = TUSB_CLASS_UNSPECIFIED, + .bDeviceSubClass = 0, + .bDeviceProtocol = 0, + .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE, + + .idVendor = 0xCafe, + .idProduct = USB_PID, + .bcdDevice = 0x0100, + + .iManufacturer = 0x01, + .iProduct = 0x02, + .iSerialNumber = 0x03, + + .bNumConfigurations = 0x01 +}; + +// Invoked when received GET DEVICE DESCRIPTOR +// Application return pointer to descriptor +uint8_t const * tud_descriptor_device_cb(void) +{ + return (uint8_t const *) &desc_device; +} + +//--------------------------------------------------------------------+ +// Configuration Descriptor +//--------------------------------------------------------------------+ +enum +{ + ITF_NUM_CDC = 0, + ITF_NUM_CDC_DATA, + ITF_NUM_TOTAL +}; + +enum +{ + STR_LANGID = 0, + STR_MANUFACTURER, + STR_PRODUCT, + STR_ITFNAME, + STR_MAC, +}; + +#if CFG_TUD_NET == OPT_NET_ECM +#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_ECM_DESC_LEN) +#elif CFG_TUD_NET == OPT_NET_RNDIS +#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_RNDIS_DESC_LEN) +#elif CFG_TUD_NET == OPT_NET_EEM +#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_EEM_DESC_LEN) +#endif + +#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX + // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number + // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ... + #define EPNUM_CDC 2 +#else + #define EPNUM_CDC 2 +#endif + +uint8_t const desc_configuration[] = +{ + // Interface count, string index, total length, attribute, power in mA + TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0, 100), + +#if CFG_TUD_NET == OPT_NET_ECM + // Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size. + TUD_CDC_ECM_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, STR_MAC, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE, CFG_TUD_NET_MTU), +#elif CFG_TUD_NET == OPT_NET_RNDIS + // Interface number, string index, EP notification address and size, EP data address (out, in) and size. + TUD_RNDIS_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE), +#elif CFG_TUD_NET == OPT_NET_EEM + // Interface number, description string index, EP data address (out, in) and size. + TUD_CDC_EEM_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE), +#endif +}; + +// Invoked when received GET CONFIGURATION DESCRIPTOR +// Application return pointer to descriptor +// Descriptor contents must exist long enough for transfer to complete +uint8_t const * tud_descriptor_configuration_cb(uint8_t index) +{ + (void) index; // for multiple configurations + return desc_configuration; +} + +//--------------------------------------------------------------------+ +// String Descriptors +//--------------------------------------------------------------------+ + +// array of pointer to string descriptors +char const* string_desc_arr [] = +{ + [STR_LANGID] = (const char[]) { 0x09, 0x04 }, // supported language is English (0x0409) + [STR_MANUFACTURER] = "TinyUSB", // Manufacturer + [STR_PRODUCT] = "TinyUSB Device", // Product + [STR_ITFNAME] = // CDC-ECM Interface +#if CFG_TUD_NET == OPT_NET_ECM + "TinyUSB CDC-ECM", +#elif CFG_TUD_NET == OPT_NET_RNDIS + "TinyUSB RNDIS", +#elif CFG_TUD_NET == OPT_NET_EEM + "TinyUSB CDC-EEM", +#endif +}; + +static uint16_t _desc_str[32]; + +// Invoked when received GET STRING DESCRIPTOR request +// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete +uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) +{ + (void)langid; + + unsigned chr_count = 0; + + if (STR_LANGID == index) + { + memcpy(&_desc_str[1], string_desc_arr[0], 2); + chr_count = 1; + } + else if (STR_MAC == index) + { + // Convert MAC address into UTF-16 + + for (unsigned i=0; i> 4) & 0xf]; + _desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 0) & 0xf]; + } + } + else + { + // Convert ASCII string into UTF-16 + + if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL; + + const char* str = string_desc_arr[index]; + + // Cap at max char + chr_count = strlen(str); + if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1; + + for (unsigned i=0; i - * - */ -#ifndef __CC_H__ -#define __CC_H__ - -//#include "cpu.h" - -typedef int sys_prot_t; - - - -/* define compiler specific symbols */ -#if defined (__ICCARM__) - -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_END -#define PACK_STRUCT_FIELD(x) x -#define PACK_STRUCT_USE_INCLUDES - -#elif defined (__CC_ARM) - -#define PACK_STRUCT_BEGIN __packed -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_END -#define PACK_STRUCT_FIELD(x) x - -#elif defined (__GNUC__) - -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) -#define PACK_STRUCT_END -#define PACK_STRUCT_FIELD(x) x - -#elif defined (__TASKING__) - -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_END -#define PACK_STRUCT_FIELD(x) x - -#endif - -#define LWIP_PLATFORM_ASSERT(x) do { if(!(x)) while(1); } while(0) - -#endif /* __CC_H__ */ diff --git a/examples/device/net_webserver/src/lwipopts.h b/examples/device/net_webserver/src/lwipopts.h deleted file mode 100644 index 23319592d..000000000 --- a/examples/device/net_webserver/src/lwipopts.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Simon Goldschmidt - * - */ -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ -#define NO_SYS 1 -#define MEM_ALIGNMENT 4 -#define LWIP_RAW 1 -#define LWIP_NETCONN 0 -#define LWIP_SOCKET 0 -#define LWIP_DHCP 0 -#define LWIP_ICMP 1 -#define LWIP_UDP 1 -#define LWIP_TCP 1 -#define ETH_PAD_SIZE 0 -#define LWIP_IP_ACCEPT_UDP_PORT(p) ((p) == PP_NTOHS(67)) - -#define TCP_MSS (1500 /*mtu*/ - 20 /*iphdr*/ - 20 /*tcphhr*/) -#define TCP_SND_BUF (2 * TCP_MSS) - -#define ETHARP_SUPPORT_STATIC_ENTRIES 1 - -#define LWIP_HTTPD_CGI 0 -#define LWIP_HTTPD_SSI 0 -#define LWIP_HTTPD_SSI_INCLUDE_TAG 0 - -#endif /* __LWIPOPTS_H__ */ diff --git a/examples/device/net_webserver/src/main.c b/examples/device/net_webserver/src/main.c deleted file mode 100644 index c193aeb0f..000000000 --- a/examples/device/net_webserver/src/main.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2020 Peter Lawrence - * - * influenced by lrndis https://github.com/fetisov/lrndis - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -/* -depending on the value of CFG_TUD_NET (tusb_config.h), this can be a CDC-ECM, RNDIS, or CDC-EEM USB virtual network adapter - -CDC-ECM should be valid on Linux and MacOS hosts -RNDIS should be valid on Linux and Windows hosts -CDC-EEM should be valid on Linux hosts - -You *must* customize tusb_config.h to set the CFG_TUD_NET definition to the type of these network adapters to emulate. - -The MCU appears to the host as IP address 192.168.7.1, and provides a DHCP server, DNS server, and web server. -*/ - -#include "bsp/board.h" -#include "tusb.h" - -#include "dhserver.h" -#include "dnserver.h" -#include "lwip/init.h" -#include "httpd.h" - -/* lwip context */ -static struct netif netif_data; - -/* shared between tud_network_recv_cb() and service_traffic() */ -static struct pbuf *received_frame; - -/* this is used by this code, ./class/net/net_driver.c, and usb_descriptors.c */ -/* ideally speaking, this should be generated from the hardware's unique ID (if available) */ -const uint8_t tud_network_mac_address[6] = {0x20,0x89,0x84,0x6A,0x96,0x00}; - -/* network parameters of this MCU */ -static const ip_addr_t ipaddr = IPADDR4_INIT_BYTES(192, 168, 7, 1); -static const ip_addr_t netmask = IPADDR4_INIT_BYTES(255, 255, 255, 0); -static const ip_addr_t gateway = IPADDR4_INIT_BYTES(0, 0, 0, 0); - -/* database IP addresses that can be offered to the host; this must be in RAM to store assigned MAC addresses */ -static dhcp_entry_t entries[] = -{ - /* mac ip address subnet mask lease time */ - { {0}, {192, 168, 7, 2}, {255, 255, 255, 0}, 24 * 60 * 60 }, - { {0}, {192, 168, 7, 3}, {255, 255, 255, 0}, 24 * 60 * 60 }, - { {0}, {192, 168, 7, 4}, {255, 255, 255, 0}, 24 * 60 * 60 } -}; - -/* DHCP configuration parameters, leveraging "entries" above */ -static const dhcp_config_t dhcp_config = -{ - {192, 168, 7, 1}, 67, /* server address (self), port */ - {192, 168, 7, 1}, /* dns server (self) */ - "usb", /* dns suffix */ - TU_ARRAY_SIZE(entries), /* number of entries */ - entries /* pointer to entries */ -}; - -static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) -{ - (void)netif; - - for (;;) - { - /* if TinyUSB isn't ready, we must signal back to lwip that there is nothing we can do */ - if (!tud_ready()) - return ERR_USE; - - /* if the network driver can accept another packet, we make it happen */ - if (tud_network_can_xmit()) - { - tud_network_xmit(p); - return ERR_OK; - } - - /* transfer execution to TinyUSB in the hopes that it will finish transmitting the prior packet */ - tud_task(); - } -} - -static err_t output_fn(struct netif *netif, struct pbuf *p, const ip_addr_t *addr) -{ - return etharp_output(netif, p, addr); -} - -static err_t netif_init_cb(struct netif *netif) -{ - LWIP_ASSERT("netif != NULL", (netif != NULL)); - netif->mtu = CFG_TUD_NET_MTU; - netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP; - netif->state = NULL; - netif->name[0] = 'E'; - netif->name[1] = 'X'; - netif->linkoutput = linkoutput_fn; - netif->output = output_fn; - return ERR_OK; -} - -static void init_lwip(void) -{ - struct netif *netif = &netif_data; - - lwip_init(); - netif->hwaddr_len = sizeof(tud_network_mac_address); - memcpy(netif->hwaddr, tud_network_mac_address, sizeof(tud_network_mac_address)); - - netif = netif_add(netif, &ipaddr, &netmask, &gateway, NULL, netif_init_cb, ip_input); - netif_set_default(netif); -} - -/* handle any DNS requests from dns-server */ -bool dns_query_proc(const char *name, ip_addr_t *addr) -{ - if (0 == strcmp(name, "tiny.usb")) - { - *addr = ipaddr; - return true; - } - return false; -} - -bool tud_network_recv_cb(struct pbuf *p) -{ - /* this shouldn't happen, but if we get another packet before - parsing the previous, we must signal our inability to accept it */ - if (received_frame) return false; - - /* store away the pointer for service_traffic() to later handle */ - received_frame = p; - return true; -} - -static void service_traffic(void) -{ - /* handle any packet received by tud_network_recv_cb() */ - if (received_frame) - { - ethernet_input(received_frame, &netif_data); - pbuf_free(received_frame); - received_frame = NULL; - tud_network_recv_renew(); - } -} - -void tud_network_init_cb(void) -{ - /* if the network is re-initializing and we have a leftover packet, we must do a cleanup */ - if (received_frame) - { - pbuf_free(received_frame); - received_frame = NULL; - } -} - -int main(void) -{ - /* initialize TinyUSB */ - board_init(); - tusb_init(); - - /* initialize lwip, dhcp-server, dns-server, and http */ - init_lwip(); - while (!netif_is_up(&netif_data)); - while (dhserv_init(&dhcp_config) != ERR_OK); - while (dnserv_init(&ipaddr, 53, dns_query_proc) != ERR_OK); - httpd_init(); - - while (1) - { - tud_task(); - service_traffic(); - } - - return 0; -} - -/* lwip has provision for using a mutex, when applicable */ -sys_prot_t sys_arch_protect(void) -{ - return 0; -} -void sys_arch_unprotect(sys_prot_t pval) -{ - (void)pval; -} - -/* lwip needs a millisecond time source, and the TinyUSB board support code has one available */ -uint32_t sys_now(void) -{ - return board_millis(); -} diff --git a/examples/device/net_webserver/src/tusb_config.h b/examples/device/net_webserver/src/tusb_config.h deleted file mode 100644 index 329fc80b9..000000000 --- a/examples/device/net_webserver/src/tusb_config.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef _TUSB_CONFIG_H_ -#define _TUSB_CONFIG_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -//-------------------------------------------------------------------- -// COMMON CONFIGURATION -//-------------------------------------------------------------------- - -// defined by compiler flags for flexibility -#ifndef CFG_TUSB_MCU - #error CFG_TUSB_MCU must be defined -#endif - -#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX -#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) -#else -#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE -#endif - -#define CFG_TUSB_OS OPT_OS_NONE - -// CFG_TUSB_DEBUG is defined by compiler in DEBUG build -// #define CFG_TUSB_DEBUG 0 - -/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. - * Tinyusb use follows macros to declare transferring memory so that they can be put - * into those specific section. - * e.g - * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) - * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) - */ -#ifndef CFG_TUSB_MEM_SECTION -#define CFG_TUSB_MEM_SECTION -#endif - -#ifndef CFG_TUSB_MEM_ALIGN -#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) -#endif - -//-------------------------------------------------------------------- -// DEVICE CONFIGURATION -//-------------------------------------------------------------------- - -#ifndef CFG_TUD_ENDPOINT0_SIZE -#define CFG_TUD_ENDPOINT0_SIZE 64 -#endif - -//------------- CLASS -------------// -#define CFG_TUD_CDC 0 -#define CFG_TUD_MSC 0 -#define CFG_TUD_HID 0 -#define CFG_TUD_MIDI 0 -#define CFG_TUD_VENDOR 0 -//#define CFG_TUD_NET OPT_NET_ECM -#define CFG_TUD_NET OPT_NET_RNDIS -//#define CFG_TUD_NET OPT_NET_EEM - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_CONFIG_H_ */ diff --git a/examples/device/net_webserver/src/usb_descriptors.c b/examples/device/net_webserver/src/usb_descriptors.c deleted file mode 100644 index 26f8aeba6..000000000 --- a/examples/device/net_webserver/src/usb_descriptors.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#include "tusb.h" -#include "usb_descriptors.h" - -/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug. - * Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC. - * - * Auto ProductID layout's Bitmap: - * [MSB] NET1:NET0 | VENDOR | MIDI | HID | MSC | CDC [LSB] - */ -#define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) ) -#define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \ - _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) | _PID_MAP(NET, 5) ) - -//--------------------------------------------------------------------+ -// Device Descriptors -//--------------------------------------------------------------------+ -tusb_desc_device_t const desc_device = -{ - .bLength = sizeof(tusb_desc_device_t), - .bDescriptorType = TUSB_DESC_DEVICE, - .bcdUSB = 0x0200, - - .bDeviceClass = TUSB_CLASS_UNSPECIFIED, - .bDeviceSubClass = 0, - .bDeviceProtocol = 0, - .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE, - - .idVendor = 0xCafe, - .idProduct = USB_PID, - .bcdDevice = 0x0100, - - .iManufacturer = 0x01, - .iProduct = 0x02, - .iSerialNumber = 0x03, - - .bNumConfigurations = 0x01 -}; - -// Invoked when received GET DEVICE DESCRIPTOR -// Application return pointer to descriptor -uint8_t const * tud_descriptor_device_cb(void) -{ - return (uint8_t const *) &desc_device; -} - -//--------------------------------------------------------------------+ -// Configuration Descriptor -//--------------------------------------------------------------------+ -enum -{ - ITF_NUM_CDC = 0, - ITF_NUM_CDC_DATA, - ITF_NUM_TOTAL -}; - -enum -{ - STR_LANGID = 0, - STR_MANUFACTURER, - STR_PRODUCT, - STR_ITFNAME, - STR_MAC, -}; - -#if CFG_TUD_NET == OPT_NET_ECM -#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_ECM_DESC_LEN) -#elif CFG_TUD_NET == OPT_NET_RNDIS -#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_RNDIS_DESC_LEN) -#elif CFG_TUD_NET == OPT_NET_EEM -#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_EEM_DESC_LEN) -#endif - -#if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX - // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number - // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ... - #define EPNUM_CDC 2 -#else - #define EPNUM_CDC 2 -#endif - -uint8_t const desc_configuration[] = -{ - // Interface count, string index, total length, attribute, power in mA - TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0, 100), - -#if CFG_TUD_NET == OPT_NET_ECM - // Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size. - TUD_CDC_ECM_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, STR_MAC, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE, CFG_TUD_NET_MTU), -#elif CFG_TUD_NET == OPT_NET_RNDIS - // Interface number, string index, EP notification address and size, EP data address (out, in) and size. - TUD_RNDIS_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, 0x81, 8, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE), -#elif CFG_TUD_NET == OPT_NET_EEM - // Interface number, description string index, EP data address (out, in) and size. - TUD_CDC_EEM_DESCRIPTOR(ITF_NUM_CDC, STR_ITFNAME, EPNUM_CDC, 0x80 | EPNUM_CDC, CFG_TUD_NET_ENDPOINT_SIZE), -#endif -}; - -// Invoked when received GET CONFIGURATION DESCRIPTOR -// Application return pointer to descriptor -// Descriptor contents must exist long enough for transfer to complete -uint8_t const * tud_descriptor_configuration_cb(uint8_t index) -{ - (void) index; // for multiple configurations - return desc_configuration; -} - -//--------------------------------------------------------------------+ -// String Descriptors -//--------------------------------------------------------------------+ - -// array of pointer to string descriptors -char const* string_desc_arr [] = -{ - [STR_LANGID] = (const char[]) { 0x09, 0x04 }, // supported language is English (0x0409) - [STR_MANUFACTURER] = "TinyUSB", // Manufacturer - [STR_PRODUCT] = "TinyUSB Device", // Product - [STR_ITFNAME] = // CDC-ECM Interface -#if CFG_TUD_NET == OPT_NET_ECM - "TinyUSB CDC-ECM", -#elif CFG_TUD_NET == OPT_NET_RNDIS - "TinyUSB RNDIS", -#elif CFG_TUD_NET == OPT_NET_EEM - "TinyUSB CDC-EEM", -#endif -}; - -static uint16_t _desc_str[32]; - -// Invoked when received GET STRING DESCRIPTOR request -// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete -uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) -{ - (void)langid; - - unsigned chr_count = 0; - - if (STR_LANGID == index) - { - memcpy(&_desc_str[1], string_desc_arr[0], 2); - chr_count = 1; - } - else if (STR_MAC == index) - { - // Convert MAC address into UTF-16 - - for (unsigned i=0; i> 4) & 0xf]; - _desc_str[1+chr_count++] = "0123456789ABCDEF"[(tud_network_mac_address[i] >> 0) & 0xf]; - } - } - else - { - // Convert ASCII string into UTF-16 - - if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL; - - const char* str = string_desc_arr[index]; - - // Cap at max char - chr_count = strlen(str); - if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1; - - for (unsigned i=0; i Date: Wed, 11 Mar 2020 10:25:46 +0700 Subject: add cdc_msc_freertos to ci --- .github/workflows/build.yml | 5 +++-- tools/build_all.py | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to '.github') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54d4babac..4cf2f1390 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,9 @@ jobs: strategy: fail-fast: false matrix: - example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'dfu_rt', 'hid_composite', 'hid_generic_inout', - 'midi_test', 'msc_dual_lun', 'net_lwip_webserver', 'usbtmc', 'webusb_serial'] + example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'cdc_msc_freertos', 'dfu_rt', + 'hid_composite', 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'net_lwip_webserver', + 'usbtmc', 'webusb_serial'] steps: - name: Setup Python uses: actions/setup-python@v1 diff --git a/tools/build_all.py b/tools/build_all.py index 4f3e28747..08964bb76 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -19,9 +19,6 @@ else: for entry in os.scandir("examples/device"): if entry.is_dir(): all_examples.append(entry.name) - - # TODO update freeRTOS example to work with all boards (only nrf52840 now) - all_examples.remove("cdc_msc_hid_freertos") all_examples.sort() # 2nd Argument is Board, build all boards if not existed -- cgit v1.3.1