Skip to content

Commit

Permalink
Add new files and update existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixLuciano committed Dec 16, 2023
1 parent e5122ad commit 1750ec4
Show file tree
Hide file tree
Showing 32 changed files with 577 additions and 633 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,16 @@ RUN cd /apps && git clone https://github.com/wtarreau/bootterm.git --depth=1 \
&& cd bootterm && make -j 8 install

RUN usermod -aG plugdev vscode


# Compile Custom Chips
RUN apt-get -y install clang lld git make llvm

RUN git clone https://github.com/CraneStation/wasi-libc.git && \
cd wasi-libc && \
make install INSTALL_DIR=/opt/wasi-libc && \
cd ../ && \
rm -rf wasi-libc

RUN mkdir -p /usr/lib/llvm16/lib/clang/16/lib/wasi && \
wget -O /usr/lib/llvm16/lib/clang/16/lib/wasi/libclang_rt.builtins-wasm32.a https://github.com/jedisct1/libclang_rt.builtins-wasm32.a/blob/master/precompiled/llvm-15-to-16/libclang_rt.builtins-wasm32.a?raw=true
44 changes: 14 additions & 30 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/mwinters-stuff/vscode-devcontainer-raspberrypi-pico
{
"name": "C++ Raspberry Pi Pico",
"build": {
"dockerfile": "Dockerfile"
},
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/bash"
}
"image": "rafaelcorsi/wokwi",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"marus25.cortex-debug",
"ms-vscode.cmake-tools",
"twxs.cmake",
"eamodio.gitlens",
"xaver.clang-format",
"chris-hock.pioasm",
"Wokwi.wokwi-vscode"
]
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"marus25.cortex-debug",
"ms-vscode.cmake-tools",
"twxs.cmake",
"eamodio.gitlens",
"xaver.clang-format",
"chris-hock.pioasm",
"Wokwi.wokwi-vscode"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gcc -v",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
}
38 changes: 2 additions & 36 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,2 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

desktop.init
atividade-*/build/**
.vscode/.cortex-debug.*
/build
*/test/chip/*.wasm
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.associations": {
"wokwi-api.h": "c"
},
"cmake.configureOnOpen": true
}
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated Cmake Pico project file

cmake_minimum_required(VERSION 3.13)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

# initalize pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
# set(PICO_SDK_PATH "/home/mathew/src/pico/pico-sdk")

# Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake)

project(Proj C CXX ASM)

set(PICO_CXX_ENABLE_EXCEPTIONS 1)

# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()

# # Add executable. Default name is the project name, version 0.1

# add_executable(main src/main.cpp)

# pico_set_program_name(main "MAIN")
# pico_set_program_version(main "0.1")

# pico_enable_stdio_uart(main 1)
# pico_enable_stdio_usb(main 0)

# # Add the standard library to the build
# target_link_libraries(main pico_stdlib)

# # Add any user requested libraries
# target_link_libraries(main hardware_clocks)

# pico_add_extra_outputs(main)

include(chip_sdk_import.cmake)

add_subdirectory(atividade-1)
add_subdirectory(atividade-2)
add_subdirectory(atividade-3)
add_subdirectory(atividade-4)
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
![](../../actions/workflows/atividade-2.yml/badge.svg)
![](../../actions/workflows/atividade-3.yml/badge.svg)
![](../../actions/workflows/atividade-4.yml/badge.svg)
![](../../actions/workflows/atividade-5.yml/badge.svg)

Configuração dos testes automáticos do Raspberry Pi Pico w.

Expand All @@ -24,7 +23,7 @@ Caso não tenha o token, acessar o seguinte site [Token Aqui](https://wokwi.com/
## Building

```
mkdir -p build
mkdir build
cd build
cmake ..
make -j4
Expand All @@ -39,5 +38,5 @@ To simulate this project, install [Wokwi for VS Code](https://marketplace.visual
This project includes a Wokwi Automation Scenario in [blink.test.yaml](blink.test.yaml). The scenario runs the simulation for 1 second, and verifies that the LED is blinking. The scenario is run automatically on every commit, using [wokwi-ci-action](https://github.com/wokwi/wokwi-ci-action). You can also run the scenario locally, using the [wokwi-cli](https://github.com/wokwi/wokwi-cli) tool:

```
wokwi-cli . --scenario blink.test.yaml --timeout 1000
wokwi-cli <atividade>/test --scenario scenario.yml --timeout 1000
```
43 changes: 10 additions & 33 deletions atividade-1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,18 @@
# Generated Cmake Pico project file
project(atividade-1 C CXX ASM)

cmake_minimum_required(VERSION 3.13)
add_executable(atividade-1 ${CMAKE_SOURCE_DIR}/atividade-1/src/main.c)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_set_program_name(atividade-1 "MAIN")
pico_set_program_version(atividade-1 "0.1")

# initalize pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
# set(PICO_SDK_PATH "/home/mathew/src/pico/pico-sdk")

# Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake)

project(Blink C CXX ASM)

set(PICO_CXX_ENABLE_EXCEPTIONS 1)

# Initialise the Raspberry Pi Pico SDK
pico_sdk_init()

# Add executable. Default name is the project name, version 0.1

add_executable(main src/main.cpp )

pico_set_program_name(main "MAIN")
pico_set_program_version(main "0.1")

pico_enable_stdio_uart(main 1)
pico_enable_stdio_usb(main 0)
pico_enable_stdio_uart(atividade-1 1)
pico_enable_stdio_usb(atividade-1 0)

# Add the standard library to the build
target_link_libraries(main pico_stdlib)
target_link_libraries(atividade-1 pico_stdlib)

# Add any user requested libraries
target_link_libraries(main
hardware_clocks
)

pico_add_extra_outputs(main)
target_link_libraries(atividade-1 hardware_clocks)

pico_add_extra_outputs(atividade-1)
load_chips(atividade-1)
1 change: 1 addition & 0 deletions atividade-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Atividade 1
30 changes: 30 additions & 0 deletions atividade-1/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <stdio.h>
#include "pico/stdlib.h"

const uint LED_PIN = 16;
const uint BUTTON_PIN = 17;

int main() {
stdio_init_all();

// Configuração dos pinos
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);

gpio_init(BUTTON_PIN);
gpio_set_dir(BUTTON_PIN, GPIO_IN);
gpio_pull_down(BUTTON_PIN);

while (true) {
if (gpio_get(BUTTON_PIN) == 1) {
// Inverte o estado do LED
gpio_put(LED_PIN, 1);
sleep_ms(250);
} else {
gpio_put(LED_PIN, 0);
sleep_ms(250);
}
}

return 0;
}
47 changes: 0 additions & 47 deletions atividade-1/src/main.cpp

This file was deleted.

Loading

0 comments on commit 1750ec4

Please sign in to comment.