Initial commit

This commit is contained in:
Piotr Rogowski 2023-08-11 09:10:29 +02:00
commit 67d42aab81
No known key found for this signature in database
GPG Key ID: 4A842D702D9C6F8F
10 changed files with 8251 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"cSpell.words": [
"FOME",
"socat"
]
}

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ubuntu:latest
WORKDIR /sim
COPY add-ubuntu-latest-apt-mirrors.sh .
RUN ./add-ubuntu-latest-apt-mirrors.sh \
&& apt update \
&& apt upgrade -y \
&& apt install -y \
gcc \
gcc-multilib \
g++-multilib \
netbase \
&& rm -rf /var/lib/apt/lists/*
COPY bundle/fome_simulator ./fome_simulator
RUN chmod +x fome_simulator
EXPOSE 29001
EXPOSE 29002
CMD ["/sim/fome_simulator"]

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Piotr Rogowski
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.

60
README.md Normal file
View File

@ -0,0 +1,60 @@
# FOME Simulator in Docker
It's just a [FOME firmware](https://github.com/FOME-Tech/fome-fw) simulator, but cross-platform.
## Running
```bash
docker compose up
```
## Using TCP
Docker container exposes TCP ports `29001` and `29002`.
Verify TCP connection:
```bash
telnet localhost 29001
```
```logs
Trying ::1...
Connected to localhost.
Escape character is '^]'.
```
Docker logs:
```logs
...
fome-simulator-docker-sim-1 | Init: connection on SD1
```
### TS Setup
![TS](docs/ts.png)
## Using Virtual Serial Port
### Linux
Install [socat](http://www.dest-unreach.org/socat/).
Bind TCP to virtual serial port:
```bash
socat pty,link=/dev/virtualcom0,raw tcp:localhost:29001
```
### macOS
Does not work on macOS, because of *System Integrity Protection*. Must use TCP instead.
## TODO
- [ ] Add FOME release `bundle` as a volume once the Linux binary is there
## Issues
CPU usage is always 100%, wtf?

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# run as root
touch /etc/apt/sources.list.d/ubuntu-latest-mirrors.list
for mirror in \
'http://ubuntu.osuosl.org/ubuntu/' \
'http://mirrors.ocf.berkeley.edu/ubuntu/' \
; do
cat /etc/apt/sources.list >> /etc/apt/sources.list.d/ubuntu-latest-mirrors.list
sed "s#http://azure.archive.ubuntu.com/ubuntu/#$mirror#" -i /etc/apt/sources.list.d/ubuntu-latest-mirrors.list
done
apt-get -o Acquire::Retries=3 update

File diff suppressed because it is too large Load Diff

BIN
bundle/fome_simulator Normal file

Binary file not shown.

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
services:
sim:
platform: linux/amd64
build: .
ports:
- "29001:29001"
- "29002:29002"

BIN
docs/ts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB