Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network #122

Closed
wants to merge 40 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
44a4bbf
Started Network module and added GET/POST requests (Apr 27, 2024).
b5i Apr 27, 2024
088e0d2
fix on linux (non tested on esp)
paxo-rch Apr 28, 2024
05049f5
Added native libcurl support for esp32 target (May 21, 2024).
b5i May 21, 2024
3aeb145
Fixed Network module.
b5i Aug 14, 2024
9e1558e
Fixed linux compilation.
b5i Aug 14, 2024
81ff183
Integrate cURL library and update workspace setup script (May 11, 2024).
Charles-Mahoudeau May 11, 2024
5957017
Add functionality to copy libcurl DLL for Windows
Charles-Mahoudeau May 11, 2024
835d3bc
Fixed github workflows for linux and windows.
b5i Aug 14, 2024
ac80d58
Merge pull request #3 from paxo-phone/feature/curl-windows
b5i Aug 14, 2024
478bae2
Merge branch 'paxo-phone:main' into network
b5i Aug 27, 2024
94eb5db
Merge remote-tracking branch 'upstream/main' into network
b5i Sep 11, 2024
558878c
Update platformio-ci.yml (sync with main)
b5i Oct 20, 2024
16cd764
Merge pull request #8 from paxo-phone/main
b5i Oct 20, 2024
d7ce48c
Merge of WiFi and GSM requests.
b5i Oct 21, 2024
809dfac
Fixed GitHub workflow for linux.
b5i Oct 21, 2024
aa6c37a
fix flash size for compilation
paxo-rch Oct 21, 2024
642e8e6
increased flash size
paxo-rch Oct 22, 2024
0166041
Reinstated panic_handler.
b5i Oct 22, 2024
67788b6
Fixed closeRequest.
b5i Oct 22, 2024
4e4c7ab
Allocate URLSession and NetworkManager on the stack.
b5i Oct 22, 2024
149b72b
Removed useless getCurrentBacktrace method.
b5i Oct 22, 2024
825ceb4
fix: maintenant le code se lance sur le vrai hardware avec les requettes
paxo-rch Oct 22, 2024
937cb02
debug
paxo-rch Oct 22, 2024
73c924c
debug
paxo-rch Oct 22, 2024
c1d6162
fix network -> ça ne plante plus
paxo-rch Oct 23, 2024
f1576a1
Debug
b5i Oct 23, 2024
97ff414
Fixed crash and bug.
b5i Oct 24, 2024
bd1ad55
debugging http gsm
paxo-rch Oct 25, 2024
5ed5ac1
Merge branch 'network' of github.com:b5i/PaxOS-9 into network
paxo-rch Oct 25, 2024
8380a60
remove debug
paxo-rch Oct 25, 2024
b232332
Documentation and bug fixes.
b5i Oct 25, 2024
1e748c1
Fixed readChunk not returning.
b5i Oct 25, 2024
87c3ca2
Fixed readChunk not unlocking gsm lock.
b5i Oct 25, 2024
b6c28f1
debug
paxo-rch Oct 25, 2024
656b922
debug
paxo-rch Oct 25, 2024
1cf65c0
Fixed requests not working on emulator.
b5i Oct 25, 2024
a73ad22
http integration gsm & network done
paxo-rch Oct 25, 2024
76f5bf3
Merge branch 'network' of github.com:b5i/PaxOS-9 into network
paxo-rch Oct 25, 2024
98d2aa8
Sync with main
b5i Oct 25, 2024
373ae52
Merge pull request #9 from paxo-phone/main
b5i Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed linux compilation.
b5i committed Aug 14, 2024
commit 9e1558ef9a10f458eb95cbd4cc567b65e7a1cc21
4 changes: 2 additions & 2 deletions .github/workflows/platformio-ci.yml
Original file line number Diff line number Diff line change
@@ -78,8 +78,8 @@ jobs:
- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Install SDL2
run: sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" && sudo apt-get update -y -qq && sudo apt-get install libsdl2-dev
- name: Install SDL2 and libcurl
run: sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" && sudo apt-get update -y -qq && sudo apt-get install libsdl2-dev && && sudo apt-get install libcurl4-openssl-dev

- name: Run tests for Linux
run: pio test -e linux --json-output-path linux-test-report.json --junit-output-path linux-test-report.xml
4 changes: 2 additions & 2 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
@@ -46,8 +46,8 @@ jobs:
- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Install SDL2
run: sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" && sudo apt-get update -y -qq && sudo apt-get install libsdl2-dev
- name: Install SDL2 and libcurl
run: sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" && sudo apt-get update -y -qq && sudo apt-get install libsdl2-dev && sudo apt-get install libcurl4-openssl-dev

- name: Build PlatformIO Project for Linux
run: pio run -e linux
170 changes: 151 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,162 @@
# PaxOS 9
# Build Instructions

![logo](https://github.com/paxo-phone/PaxOS-9/assets/45568523/ddb3b517-605c-41b4-8c1e-c8e5d156431b)
If you are using CLion, please use the [CLion Instructions](#clion-instructions).

[![PlatformIO](https://github.com/paxo-phone/PaxOS-9/actions/workflows/platformio.yml/badge.svg)](https://github.com/paxo-phone/PaxOS-9/actions/workflows/platformio.yml)
[![PlatformIO CI](https://github.com/paxo-phone/PaxOS-9/actions/workflows/platformio-ci.yml/badge.svg)](https://github.com/paxo-phone/PaxOS-9/actions/workflows/platformio-ci.yml)
## Install dependencies

**PaxOS 9** est la dernière version du **PaxOS**, un système d'exploitation léger destiné aux PaxoPhones.
### Install PlatformIO Core

- [Licence](#licence)
- [Contact](#contact)
- [En savoir plus](#see-more)
- [Contributeurs](#contributors)
> https://docs.platformio.org/en/latest/core/installation/methods/installer-script.html#local-download-macos-linux-windows

# Licence
Ce projet est distribué sous licence AGPL-3.0.
> https://docs.platformio.org/en/latest/core/installation/shell-commands.html#piocore-install-shell-commands

# Contact
### Install SDL2

Vous pouvez nous contacter via notre [site internet](https://www.paxo.fr) ou notre [serveur Discord](https://discord.com/invite/MpqbWr3pUG).
_(If you are on Windows, skip this step)_

# En savoir plus

En savoir plus sur [paxo.fr](https://www.paxo.fr)
```shell
# for linux
sudo apt-get install libsdl2-dev
# for macos using homebrew
brew install sdl2
```

# Contributeurs
### Install libcurl

<a href="https://github.com/paxo-phone/PaxOS-9/graphs/contributors">
<img src="https://contrib.rocks/image?repo=paxo-phone/PaxOS-9" />
</a>
_(If you are on Windows, skip this step)_


```shell
# for linux
sudo apt-get install libcurl4-openssl-dev
# for macos using homebrew
brew install curl
```

## Clone the repository

```shell
git clone https://github.com/paxo-phone/PaxOS-9.git
```

## Initialize the project

```shell
pio project init
```

## Build

```shell
# Build for ESP32
pio run -e esp32dev

# Build for Windows
pio run -e windows

# Build for Linux
pio run -e linux

# Build for MacOS
pio run -e macos
```

## Run on ESP32

```shell
pio run -t upload -e esp32dev
```

## Run Tests

```shell
pio test -e test
```

## Troubleshooting

### macOS
- If you get a popup saying that the program is from an unidentified developer, do `xattr -d com.apple.quarantine program` in the same directory as the `program`.
- If no program is launching at the end of the build when calling `pio run -e macos`, try to run the executable using `.pio/build/macos/program`.
- If you get an error similar to
```
dyld[xxxxx]: Library not loaded: @rpath/libSDL2-2.0.0.dylib
Referenced from: <xxxxxx> /Users/username/PaxOS-9/.pio/build/macos/program
Reason: no LC_RPATH's found
zsh: abort .pio/build/macos/program
```
Try to do ```DYLD_LIBRARY_PATH="`brew --prefix sdl2`/lib" .pio/build/macos/program``` and if it still doesn't work and you haven't installed SDL2 locally as decribed in the next bullet point (otherwise run ```DYLD_LIBRARY_PATH="`eval echo ~$USER`/sdl2/lib" .pio/build/macos/program```) do:
1. Get the location of SDL's dynamic library by executing `brew info sdl2`, you should get a path similar to `/opt/homebrew/Cellar/sdl2/2.28.5`
2. Run `ls {the path you got from the last command}/lib/libSDL2-2.0.0.dylib`. If you get the exact same path as an output you're ready to go. Otherwise install SDL as described above in this document and retry the procedure.
3. Re-run the command by adding `DYLD_LIBRARY_PATH="{the path you got from step 1}/lib/"` as a prefix before the command like this `DYLD_LIBRARY_PATH="{the path you got from step 1}/lib/ .pio/build/macos/program`
- When compiling the project using pio you might encounter an error where your shell can't find `pio` even if you installed it via the quick-setup. To fix that, execute `pio` directly from the binaries path that is located at `/Users/username/.platformio/penv/bin/pio`. If you have PaxOS9 installed directly in your home (i.e. `/Users/username/PaxOS9`), run pio via `../.platformio/penv/bin/pio`. To build for macOS it would give something similar this `../.platformio/penv/bin/pio run -e macos`.
- If you get the `unknown platform` error when compiling, that probalby means that SDL2 is not installed where it should or even just not installed at all. If you have admin permissions for your machine run `brew install sdl2`. If you don't, then install SDL2 locally by following those steps:
1. Execute the following command (don't worry it won't hack into your computer)
```
cd `eval echo ~$USER` && rm -rf sdl2-build && rm -rf sdl2 && mkdir sdl2 && git clone https://github.com/libsdl-org/SDL.git -b SDL2 sdl2-build && cd sdl2-build && mkdir build && cd build && ../configure --prefix=`eval echo ~$USER`/sdl2 && make -j`sysctl -n hw.ncpu` && make install && cd `eval echo ~$USER` && rm -rf sdl2-build && echo "Installed SDL at `eval echo ~$USER`/sdl2" && echo "\033[0;32mThe two lines to add to the macos target (\033[1;34mbuild_flags\033[0;32m) of the \033[1;34mplatform.ini\033[0;32m in your PaxOS9 directory are \033[1;33m-I`eval echo ~$USER`/sdl2/include\033[0;32m and \033[1;33m-L`eval echo ~$USER`/sdl2/lib\033[0;32m"
```
2. Follow the instructions that the command gave you (add the two lines). The place where you should put the lines looks like this (the filename is called `platform.ini` and is present in the `PaxOS9` directory):
```
[env:macos]
platform = native
lib_deps =
x
x
x
test_framework = googletest
build_flags =
x
x
x
x
-I/opt/homebrew/include/SDL2
-L/opt/homebrew/lib
-->PLACE THE LINES SEPARATED BY A NEW LINE HERE <--
```

# CLion Instructions

## Install dependencies

### Install PlatformIO plugin

* Launch CLion
* Install the ``PlatformIO for CLion`` Plugin by ``JetBrains``
* Restart the IDE

### Install MinGW-w64

Even if CLion comes with a full MinGW installation.\
This is required by PlatformIO, because it uses ``g++`` for compilation.\
You _may_ want to try to add the CLion's MinGW installation to Path, but it's not recommended.

* Go to https://winlibs.com/
* Select the ``Zip archive`` for ``GCC 13.2.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 17.0.6 + MinGW-w64 11.0.1 (UCRT) - release 4`` for ``Win64``, or [direct download](https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0posix-17.0.6-11.0.1-ucrt-r4/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r4.zip)
* Extract it in ``C:\mingw64`` (So you have the ``bin`` folder at ``C:\mingw64\bin``)
* Add ``C:\mingw64\bin`` to your PATH

## Clone the repository

* On the ``Welcome to CLion`` window, select ``Get from VCS`` (or go to ``File -> New -> Project from Version Control...``)
* Enter the repository URL (``https://github.com/paxo-phone/PaxOS-9.git``)
* Open the project as a ``PlatformIO`` project, not ``CMake`` (this step is very important)
* Wait the IDE to import the project (this can take several minutes)

## Build

Don't forget to re-build the project before running it,\
you can get weird behaviors by not doing so.

* Select the correct target
* Click the ``Build`` button

## Run on ESP32

* Select the ``esp32dev`` target
* Click on the ``Run`` button _(don't forget to build before)_

## Run Tests

* Select the ``test`` target
* Click on the ``Run`` button _(don't forget to build before)_
4 changes: 0 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -122,10 +122,6 @@ build_flags =
-lm
-lSDL2main
-lSDL2
-I/usr/local/include/SDL2
-L/usr/local/lib
-I/opt/homebrew/include/SDL2
-L/opt/homebrew/lib
-lcurl
-I/usr/local/include/SDL2 # we include both /usr/local/ and /opt/homebrew/ to support the macOS silicon and Intel as explained here https://stackoverflow.com/a/71186857/16456439
-L/usr/local/lib