Compare commits

..

59 Commits
v2.18 ... cmake

Author SHA1 Message Date
Ben V. Brown
4c17b0443c Drop stubs 2022-06-20 21:05:41 +10:00
Ben V. Brown
22d0b0d643 Private links 2022-06-20 19:16:09 +10:00
Ben V. Brown
e6a080c33d CMake 2022-06-20 17:45:25 +10:00
Ben V. Brown
078b8f5626 DeviceID (#1314)
* Ability to print hex

* Add device ID getter

* Refactor debug menu

* No longer need patch

* Update make_translation.py

* Fix typo

* Fix hex drawing
2022-06-16 21:39:53 +10:00
Ben V. Brown
165a9952c2 MHP30: Shutdown settings (#1307)
* Reduce PPS max to 20V to avoid instability

Some PSU's cant actually run at 21V

* Creating a rough draft of a "pre start check" concept

* Newer alpine

* Cleaning up MHP detection

* Cleanup comments

* PID: Run prestart based on ADC IRQ rather than times

* MHP30: Far better startup for detecting tip gain

* Newer alpine for github CI

* Bugfix: Exit on movement

* Feature: Shutdown timeout for MHP30
2022-06-16 20:28:49 +10:00
Ben V. Brown
3bb1b7bc32 Startup behaviour fixes (#1306)
* Reduce PPS max to 20V to avoid instability

Some PSU's cant actually run at 21V

* Creating a rough draft of a "pre start check" concept

* Newer alpine

* Cleaning up MHP detection

* Cleanup comments

* PID: Run prestart based on ADC IRQ rather than times

* MHP30: Far better startup for detecting tip gain

* Newer alpine for github CI
2022-06-16 20:21:46 +10:00
Ben V. Brown
f5cb42c9d7 Infinite logo (#1309)
* Check for button timeout of infinite

* Dedupe

* Alpine bump
2022-06-16 20:21:30 +10:00
discip
e2eea84e36 removed some more redundant entries (#1312) 2022-06-14 15:12:20 +10:00
Ben V. Brown
4e36ee8142 Merge pull request #1304 from JugglerLKR/master
Update translation_RU.json
2022-05-27 09:09:25 +10:00
JugglerLKR
8da8960192 Update translation_RU.json 2022-05-26 20:01:45 +03:00
Ben V. Brown
e9115ef507 Merge pull request #1297 from FaBjE/feature/update_dutch_translation
Update dutch translation
2022-05-18 12:23:31 +10:00
Ben V. Brown
9772e4d0ea Merge branch 'master' into feature/update_dutch_translation 2022-05-18 12:20:16 +10:00
Ben V. Brown
670606a26f Merge pull request #1289 from onxblog/patch-3
Fix for slang expressions
2022-05-18 12:19:49 +10:00
Ben V. Brown
9ab393881e Merge branch 'master' into patch-3 2022-05-18 11:29:12 +10:00
Ben V. Brown
648347c6b2 Merge pull request #1302 from BjoernLange/pinecil-flashing-troubleshooting-usb-autosuspend
Add USB autosuspend to troubleshooting for Pinecil
2022-05-18 08:28:39 +10:00
Björn Lange
e562c3a9f1 Add USB autosuspend to troubleshooting for Pinecil 2022-05-17 20:22:15 +02:00
FaBjE
4e46676bec Dutch translation: Fix another typo 2022-05-14 18:39:28 +02:00
FaBjE
f7d7f5cd07 Dutch translation: Fix typo 2022-05-14 13:33:23 +02:00
FaBjE
2ecf9c9742 Update dutch translation 2022-05-08 16:52:06 +02:00
Ben V. Brown
e6f1eb6729 Merge pull request #1293 from discip/patch-1
removing some redundant lines
2022-05-04 08:58:17 +10:00
discip
cc269361b5 Merge pull request #2 from discip/patch-2
Update Font.h
2022-05-04 00:18:15 +02:00
discip
9ec92298f3 Update Font.h 2022-05-04 00:17:34 +02:00
discip
c0bde3c678 Merge pull request #1 from discip/patch-2
Update Power.cpp
2022-05-04 00:15:59 +02:00
discip
a5975b3385 Update Power.cpp 2022-05-04 00:13:46 +02:00
discip
14eb587856 Update Pins.h 2022-05-04 00:10:44 +02:00
Ben V. Brown
fd7db70fde Merge pull request #1291 from dmitrygribenchuk/patch-2
Update translation_BE.json
2022-05-03 10:36:48 +10:00
dmitrygribenchuk
e578e5a844 Update translation_BE.json 2022-05-02 11:53:20 +03:00
Ben V. Brown
c4a2ed8482 Merge pull request #1290 from cewbdex/CS-upd
Update Czech translation
2022-04-30 08:50:48 +10:00
Kryštof Černý
cfa7258f00 Update Czech translation 2022-04-29 19:28:03 +02:00
Ben V. Brown
b3e3a7e1e5 Merge pull request #1287 from dmitrygribenchuk/patch-1
Update translation_BE.json
2022-04-27 10:59:07 +10:00
Alex
4dc2afb8b3 Fix for slang expressions
It was technically not a literary translation.
2022-04-26 17:01:42 +03:00
dmitrygribenchuk
103599deca Update translation_BE.json
fix to correct form and fix "i" letter
2022-04-26 15:48:57 +03:00
Ben V. Brown
d90d620a51 Merge pull request #1286 from KITT3000/patch-5
Update PL translation (v2.18)
2022-04-24 22:57:54 +10:00
Ziuta
e8188f4caa Update PL translation (v2.18) 2022-04-24 13:07:32 +02:00
Ben V. Brown
7377f88b83 Merge pull request #1284 from River-b/patch-1
Update README.md
2022-04-23 23:16:15 +10:00
River B
e37ecdcf75 Update README.md 2022-04-23 06:09:26 -07:00
Ben V. Brown
c2fc4f911b Merge pull request #1279 from cewbdex/patch-3
Typo fixes and various improvements
2022-04-22 20:12:44 +10:00
Ben V. Brown
c0b9440540 Merge branch 'master' into patch-3 2022-04-22 19:49:28 +10:00
Ben V. Brown
4e78c42f43 Merge pull request #1282 from dmitrygribenchuk/patch-1
Update translation_BE.json
2022-04-21 22:18:24 +10:00
dmitrygribenchuk
665badd227 Update translation_BE.json 2022-04-21 14:46:09 +03:00
Ben V. Brown
0b98224f3a Merge pull request #1281 from LyricPants66133/patch-1
Minor Bootup Logo readme fix
2022-04-20 09:46:07 +10:00
Alfredo Colas
baeb1091b8 Minor Bootup Logo readme fix
fixed incorrectly formatted file link in readme
2022-04-19 19:43:45 -04:00
Ben V. Brown
6c261cf754 Merge pull request #1278 from cewbdex/patch-2
Update docs with new Miniware DFU bootloader
2022-04-20 09:04:07 +10:00
Ben V. Brown
79f46b4ccd Merge pull request #1280 from JugglerLKR/master
Update translation_RU.json
2022-04-20 09:03:16 +10:00
JugglerLKR
12729821fa Update translation_RU.json
LOGO time translation
2022-04-19 16:55:51 +03:00
JugglerLKR
69f0f43c1a Update translation_RU.json
String "Invert screen can be longer", so now it says "Инвесрия"
2022-04-19 16:49:37 +03:00
Kryštof Černý
0a00e3fee3 Update the upper part of the document 2022-04-19 13:18:52 +02:00
Kryštof Černý
210f1a2ff0 Fix in Troubleshooting.md 2022-04-19 13:07:12 +02:00
Kryštof Černý
c68cedf8cf Fix in Power.md 2022-04-19 13:01:40 +02:00
Kryštof Černý
d808345b5b Typo fix in Logo.md 2022-04-19 13:00:41 +02:00
Kryštof Černý
5654ec0db2 Typo fix in Menu.md 2022-04-19 12:58:01 +02:00
Kryštof Černý
38eec2f8e2 Typo fixes in HardwareIssues.md 2022-04-19 12:53:35 +02:00
Kryštof Černý
d5af6447e3 Typo fix in Hardware.md 2022-04-19 12:50:22 +02:00
Kryštof Černý
dafde85a4b Typo fixes in Development.md 2022-04-19 12:45:44 +02:00
Kryštof Černý
c1ebc869ca Typo fixes in DebugMenu.md 2022-04-19 12:43:38 +02:00
Kryštof Černý
3f98b2d111 Typo fixes Flashing.md 2022-04-19 12:40:23 +02:00
Kryštof Černý
9b66f60b25 Update docs with new Miniware DFU bootloader 2022-04-19 12:23:15 +02:00
Ben V. Brown
70565de2e5 Update push for git permissions
https://github.com/actions/checkout/issues/760
2022-04-19 09:24:40 +10:00
Ben V. Brown
1b562c6466 Update version.h 2022-04-19 09:20:53 +10:00
123 changed files with 4284 additions and 4024 deletions

View File

@@ -6,7 +6,7 @@ jobs:
build:
runs-on: ubuntu-20.04
container:
image: alpine:3.15
image: alpine:3.16
strategy:
matrix:
model: ["TS100", "TS80", "TS80P", "Pinecil", "MHP30"]
@@ -23,6 +23,9 @@ jobs:
with:
submodules: true
- name: Git ownership exception
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
- name: build ${{ matrix.model }}
run: cd source && ./build.sh -m ${{ matrix.model }}
@@ -54,7 +57,7 @@ jobs:
build_multi-lang:
runs-on: ubuntu-20.04
container:
image: alpine:3.15
image: alpine:3.16
strategy:
matrix:
model: ["Pinecil"]
@@ -70,6 +73,9 @@ jobs:
with:
submodules: true
- name: Git ownership exception
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
- name: build ${{ matrix.model }}
run: cd source && make -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese
@@ -101,7 +107,7 @@ jobs:
tests:
runs-on: ubuntu-20.04
container:
image: alpine:3.15
image: alpine:3.16
steps:
- name: deps
@@ -128,7 +134,7 @@ jobs:
check_formatting:
runs-on: ubuntu-20.04
container:
image: alpine:3.15
image: alpine:3.16
steps:
- name: deps

4
.gitignore vendored
View File

@@ -176,4 +176,6 @@ fabric.properties
CoreCompileInputs.cache
.vscode/settings.json
source/compile_commands.json
source/compile_commands.json
source/build/
source/null.cpp

View File

@@ -4,4 +4,4 @@ IronOS supports both a bootup logo _AND_ bootup animations.
However, they are no longer included in this repo.
(Please read the docs)[../Documentation/Logo.md]
[Please read the docs](../Documentation/Logo.md)

View File

@@ -1,4 +1,4 @@
FROM alpine:3.15
FROM alpine:3.16
LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>"
WORKDIR /build
@@ -9,11 +9,13 @@ WORKDIR /build
# musl-dev is required for the multi lang firmwares
# clang is required for clang-format (for dev)
RUN apk add --no-cache gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf newlib-arm-none-eabi findutils python3 py3-pip make git musl-dev clang bash clang-extra-tools
RUN apk add --no-cache gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf newlib-arm-none-eabi findutils python3 py3-pip make git musl-dev clang bash clang-extra-tools cmake
# Install Python3 packages
RUN python3 -m pip install bdflib black
# Git trust
RUN git config --global --add safe.directory /build/source
COPY . /build/source
COPY ./ci /build/ci

View File

@@ -5,7 +5,7 @@ This is accessed by holding the rear (-/B) button on the iron while it is on the
This menu is meant to be simple, so it has no fancy GUI animations.
To move through the menu use the front (+/A) button.
To move through the menu, use the front (+/A) button.
To exit, use the rear (-/B) button again.
## Menu items
@@ -31,8 +31,8 @@ This just shows how many deciseconds the unit has been powered for.
### Move
This is the last timestamp of movement. When the iron is moved this should update to match the time field (one before in the menu).
This can be used for checking performance of the movement dection code.
This is the last timestamp of movement. When the iron is moved, this should update to match the time field (one before in the menu).
This can be used for checking performance of the movement detection code.
### RTip
@@ -74,12 +74,12 @@ This may change during power up as the sources are negotiated in turn.
- **PD W. VBus** input (We used the PD subsystem to negotiate for the current supply); and VBus is connected to your input power source
- **PD No VBus** input (We used the PD subsystem to negotiate for the current supply); and VBus is **NOT** connected to your input power source
- If you successfully modified the Pinecil to support 24 V by cutting the trace line to Vbus, then 'PD No VBus' displays on screen.
- Connect to any PD USB power to check Vbus status. It will not show any PD message when Pinecil is powered by DC port, QC, or USB 5 V (non PD).
- Connect to any PD USB power to check Vbus status. It will not show any PD message when Pinecil is powered by DC port, QC, or USB 5 V (non-PD).
### Max
This indicates the max temperature in degrees Celsius that the system estimates it can measure the tip reliably to.
This is dependant on a few factors including the handle temperature so it can move around during use.
This is dependent on a few factors including the handle temperature so it can move around during use.
### Hall

View File

@@ -94,11 +94,11 @@ To build a release instead, run the `build.sh` script. This will update translat
## Updating languages
To update the language translation files and their associated font maps, execute the `make_translation.py` code from the `Translations` directory.
If you edit the translation definitions or the english translation, please also run `gen_menu_docs.py` to update the settings menu documentation automatically.
If you edit the translation definitions or the English translation, please also run `gen_menu_docs.py` to update the settings menu documentation automatically.
## Building Pinecil
I highly recommend using the command line tools and using Docker to run the compiler.
It's a bit more fussy on setup than the STM tooling, and this is by far the easiest way.
It's a bit fussier on setup than the STM tooling, and this is by far the easiest way.
If you _need_ an IDE I have used [Nuclei's IDE](https://nucleisys.com/download.php).
Follow the same idea as the STM Cube IDE notes above.

View File

@@ -11,7 +11,7 @@ These are built on every change and can be found on the Actions tab (see below).
### Main release
Main releases are made to the [releases page](https://github.com/Ralim/IronOS/releases).
Download the zip file that matches your model of soldering iron, and extract it.
Download the zip file that matches your model of soldering iron and extract it.
Select the appropriate file type for your unit, in general Miniware devices need `.hex` and Pinecil needs `.dfu`.
Flash according to details below
@@ -31,7 +31,7 @@ This is completely safe, but if it goes wrong just put the `.hex` file from the
Officially the bootloader on the devices only works under Windows (use the built-in File Explorer, as alternative file managers or copy handlers like Teracopy will fail). However, users have reported that it does work under Mac, and can be made to work under Linux _sometimes_. Details over on the [wiki page](https://github.com/Ralim/ts100/wiki/Upgrading-Firmware).
1. Hold the button closest to the tip (MHP30 the left button on the back), and plug in the USB to the computer.
2. The unit will appear as a USB drive. ( Screen will say `DFU` on it.)
2. The unit will appear as a USB drive. (Screen will say `DFU` on it.)
3. Drag the `.hex` file onto the USB drive.
4. The unit will disconnect and reconnect.
5. The filename will have changed to end in *.RDY* or *.ERR*
@@ -39,9 +39,9 @@ Officially the bootloader on the devices only works under Windows (use the built
7. If it didn't work the first time, try copying the file again without disconnecting the device, often it will work on the second shot.
8. Disconnect the USB and power up the device. You're good to go.
For the more adventurous out there, you can also load this firmware onto the device using an SWD programmer.
For the more adventurous out there, you can also load this firmware onto the device using an SWD programmer, for easier installation follow the guide at the end of this document.
On the bottom of the MCU riser PCB, there are 4 pads for programming. On v2.51A PCB revision `USB_D+` is shorted to `SWDIO` and `USB_D-` is shorted to `SWCLK` so debugging works without disassembly (attach while staying in the bootloader). Installing [dapboot from eDesignOSS](https://github.com/eDesignOSS/dapboot) (`make TARGET=TS100 -C src`) is recommended as it allows reliable flashing of binary files with [dfu-util](http://dfu-util.sourceforge.net/).
On the bottom of the MCU riser PCB, there are 4 pads for programming. On v2.51A PCB revision `USB_D+` is shorted to `SWDIO` and `USB_D-` is shorted to `SWCLK` so debugging works without disassembly (attach while staying in the bootloader). Installing [IronOS-dfu](https://github.com/Ralim/IronOS-dfu) is recommended as it allows reliable flashing of binary files with [dfu-util](http://dfu-util.sourceforge.net/).
There is a complete device flash backup included in this repository. (Note this includes the bootloader, so will need an SWD programmer to load onto the unit).
@@ -90,11 +90,11 @@ Check the extension of your firmware, it should be `.RDY` now.
# Pinecil (Pine64)
- The MCU used in Pinecil supports usb-dfu. Reference [Pinecil Wiki](https://wiki.pine64.org/wiki/Pinecil).
- Recommended Updater: the [Pine64 Updater](https://github.com/pine64/pinecil-firmware-updater/releases), is an easy-to-use GUI app. It is fast and works in several types of OS, i.e. Windows/Mac. It will automatically fetch the newest stable version of IronOS from Github.
- Recommended Updater: the [Pine64 Updater](https://github.com/pine64/pinecil-firmware-updater/releases), is an easy-to-use GUI app. It is fast and works in several types of OS, i.e. Windows/Mac. It will automatically fetch the newest stable version of IronOS from GitHub.
- Troubleshooting: if you have issues using the Pine64 Updater or your install fails, please go to troubleshooting tips below.
- Community chat: if troubleshooting doesn't work, then join the Pine64 > Pinecil channel. There are knowledgeable members in Discord/Telegram/Matrix. Discord has a bridge bot connection to Telegram and Matrix so that all pine volunteers/members can see advice for Pinecil and related items or just get tips on which Power supply to purchase.
- One advantage of Pinecil is that you can not permanently damage it doing a firmware update (because DFU is in ROM); an update could render Pinecil temporarily inoperable if you flash an invalid firmware. But no worries, simply re-flashing with a working firmware copy will fix everything.
- USB-C cable is required to do an update. Generally, all USB controllers work, but some hubs have issues so it is preferred to avoid USB hubs for updates.
- One advantage of Pinecil is that you cannot permanently damage it doing a firmware update (because DFU is in ROM); an update could render Pinecil temporarily inoperable if you flash an invalid firmware. But no worries, simply re-flashing with a working firmware copy will fix everything.
- USB-C cable is required to do an update. Generally, all USB controllers work, but some hubs have issues, so it is preferred to avoid USB hubs for updates.
- Alternate Update Methods: if your OS is not currently supported by the [Updater](https://github.com/pine64/pinecil-firmware-updater/releases) or it does not meet your needs, i.e., you want to install a beta version, the below manual methods may be used.
## Linux and Mac
@@ -103,7 +103,7 @@ Check the extension of your firmware, it should be `.RDY` now.
⛔ Do not use the DC power jack while updating firmware or you may destroy your PC. ⛔
1. Download and extract the firmware package from Github [IronOS Releases](https://github.com/Ralim/IronOS/releases).
1. Download and extract the firmware package from GitHub [IronOS Releases](https://github.com/Ralim/IronOS/releases).
2. Highly recommend updating `dfu-util` to the newest version.
3. Enter DFU mode: press and hold (-) button at the back of the iron (do not release).
4. Connect USB to PC, and USB-C to back of Pinecil, keep holding (-) button down.
@@ -115,7 +115,7 @@ Check the extension of your firmware, it should be `.RDY` now.
dfu-util -D Pinecil_EN.dfu
```
Choose the file name from the folder with the appropriate 2-letter country code for your chosen language (i.e, EN = English).
Choose the file name from the folder with the appropriate 2-letter country code for your chosen language (i.e., EN = English).
### Troubleshooting:
- If you get a message stating that `More than one DFU capable USB device found!` when running the above command you probably have an old version of `dfu-util` installed. Might be worth updating. You can still install on the old version, but you will have to specify which DFU interface to flash to. Running the command `dfu-util -l` will show you if there are several DFU devices detected. Example:
@@ -129,10 +129,34 @@ dfu-util -D Pinecil_EN.dfu -a 0
```
- Note: if you use an older release of `dfu-util` and do not see `alt=0, name="@Internal Flash /0x08000000/128*001Kg"` when running `dfu-util -l` you likely will not be able to update without first updating 'dfu-util'.
- If your update is crashing part-way into the update, there is sometimes an issue with older/fussy USB controllers (they can show up/disappear/then show up again)
- Try a direct connection to the USB port, do not use a USB hub, and use shorter cable. If possible pick a port connected to the main board.
- Try a direct connection to the USB port, do not use a USB hub, and use shorter cable. If possible, pick a port connected to the main board.
- Switch to a different PC/Laptop and use different ports. USB-C ports are recommended but some have also reported having a fussy C port.
- Hold down the (-) button for the entire firmware update, do not release until near the end.
- `DC Low` message: a pc/laptop can not fully power pinecil, it generally can only get 5 V (non-PD) to communicate for firmware updates and Pinecil will report 'DC Low'. This is normal.
- `DC Low` message: a pc/laptop cannot fully power Pinecil, it generally can only get 5 V (non-PD) to communicate for firmware updates and Pinecil will report 'DC Low'. This is normal.
- If `dfu-util` aborts with an error like
```
dfu-util: Cannot open DFU device 28e9:0189 found on devnum 42 (LIBUSB_ERROR_IO)
```
and `dmesg` reports USB errors like these
```
kernel: usb 1-1: reset full-speed USB device number 42 using xhci_hcd
kernel: usb 1-1: device descriptor read/64, error -71
kernel: usb 1-1: device descriptor read/64, error -71
kernel: usb 1-1: reset full-speed USB device number 42 using xhci_hcd
kernel: usb 1-1: device descriptor read/64, error -71
kernel: usb 1-1: device descriptor read/64, error -71
kernel: usb 1-1: reset full-speed USB device number 42 using xhci_hcd
kernel: usb 1-1: Device not responding to setup address.
kernel: usb 1-1: Device not responding to setup address.
kernel: usb 1-1: device not accepting address 42, error -71
```
then try to disable USB autosuspend.
This can be done with a set of udev rules specifically for the Pinecil:
```udev
SUBSYSTEM=="usb", ATTR{idVendor}=="28e9", ATTR{idProduct}=="0189", MODE:="0660"
SUBSYSTEM=="usb", ATTR{idVendor}=="28e9", ATTR{idProduct}=="0189", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="28e9", ATTR{idProduct}=="0189", TEST=="power/control", ATTR{power/control}="on"
```
## Windows
@@ -147,7 +171,7 @@ Two Options for Windows
1. Using command line `dfu-util` is similar to above for Linux / Mac.
2. Highly recommend updating `dfu-util` to the newest version.
3. Download and extract the firmware package from Github [IronOS Releases](https://github.com/Ralim/IronOS/releases).
3. Download and extract the firmware package from GitHub [IronOS Releases](https://github.com/Ralim/IronOS/releases).
4. Enter DFU mode: press and hold (-) button at the back of the iron (do not release).
5. Connect USB to PC, and USB-C to the back of Pinecil, keep holding (-) button down.
6. Screen will stay **black/off** to indicate the Pinecil is in DFU mode. This is normal.
@@ -162,14 +186,14 @@ dfu-util -D Pinecil_EN.dfu
- If you have errors, see Troubleshooting [above](/Documentation/Flashing.md#troubleshooting).
### Option 2: use the gui tool from chip vendor
### Option 2: use the GUI tool from chip vendor
### Steps
⛔ Do not use the DC power jack while updating firmware or you may destroy your PC. ⛔
1. If you are uncomfortable with the command line, then this chip vendor supplied gui tool/drivers is an option.
2. Download and extract the firmware package from Github [IronOS Releases](https://github.com/Ralim/IronOS/releases).
1. If you are uncomfortable with the command line, then this chip vendor supplied GUI tool/drivers is an option.
2. Download and extract the firmware package from GitHub [IronOS Releases](https://github.com/Ralim/IronOS/releases).
3. Download both the `GD32 MCU DFU TOOL` and the `GD32 Dfu Drivers`.
- GD32 DFU Tool [here](http://www.gd32mcu.com/en/download?kw=GD32+MCU+Dfu+Tool&lan=en). If the link breaks, search for "GD32 MCU Dfu Tool" at this [link](http://www.gd32mcu.com/en/download/).
- GD32 DFU Drivers [here](http://www.gd32mcu.com/en/download?kw=GD32+Dfu+Drivers&lan=en). If the link breaks, search for "GD32 Dfu Drivers" at this [link](http://www.gd32mcu.com/en/download/).
@@ -179,15 +203,15 @@ dfu-util -D Pinecil_EN.dfu
6. Connect Pinecil to a PC via USB cable (do not release the (-) yet).
7. Screen will stay **black/off** to indicate the Pinecil is in DFU mode. This is normal.
8. You may hear a beep from Windows as it connects to Pinecil in DFU mode.
9. If you see windows notification that it `does not recognize Usb device`, then you didn't connect, repeat step 3-8.
9. If you see windows notification that it `does not recognize USB device`, then you didn't connect, repeat step 3-8.
10. Open the GD32 DFU Tool (ignore prompts to update tool).
11. At the top of the DFU tool, you should see `GD DFU DEVICE 1` appear if you successfully connected Pinecil.
12. If DFU Device box at top is blank, then Pinecil is not connected in DFU mode, repeat steps 3-11.
13. If it has been more than 10 seconds since you connected the USB cable, Release the (-) button. (don't use Upload from Device section)
14. Select `Download to device` > Open > Browse to folder dyou unziped in step 2.
15. Select the `hex` file for language. English is Pinecil_EN.hex , tick `Verify after download`.
16. Click `OK` at bottom. After a few minutes you will see 0-100%, Download successfully! Click `Leave DFU` at the top.
17. Disconnect pinecil cable from PC, plug it into a power supply.
14. Select `Download to device` > Open > Browse to folder you unzipped in step 2.
15. Select the `hex` file for language. English is Pinecil_EN.hex , tick `Verify after download`.
16. Click `OK` at bottom. After a few minutes you will see 0-100%, Download successfully! Click `Leave DFU` at the top.
17. Disconnect Pinecil cable from PC, plug it into a power supply.
18. Do not need to press any buttons, a new screen should appear.
19. To confirm upgrade, hold the minus (-) button down for a few seconds, it then shows new firmware version v2.xx.x....date
@@ -213,20 +237,19 @@ First, try just copying the file a second time.
If this fails and you are on Mac or Linux reading the wiki page about programming can help. There is also a very long issue thread going through all of the different attempts around this too.
If you are on Windows, it's often best to try another computer (friends, work, partners etc).
If you are on Windows, it's often best to try another computer (friends, work, partners etc.).
#### [Miniware] Device randomly disconnects or does not show up in DFU mode
1. Check if the USB cable you are using has the data pins; test it on another device. There are a surprisingly large number of usb-micro cables that are power _only_.
1. Check if the USB cable you are using has the data pins; test it on another device. There are a surprisingly large number of micro-USB cables that are power _only_.
2. Try other USB ports. Often different USB controllers will interact with the units differently due to design quirks in the miniware design.
2. Try other USB ports. Often different USB controllers will interact with the units differently due to design quirks in the Miniware design.
### [Miniware] Alternative bootloader
If you are an advanced user, and you have used `usb-dfu` tools before, or you would like to learn; there is an alternative bootloader for these irons.
This will **NOT** show up as a USB storage drive, but instead show up using a standard DFU protocol device. You can then use dfu tools or GUI's to upgrade the iron using the `.bin` files that are posted to the releases page.
This will **NOT** show up as a USB storage drive, but instead show up using a standard DFU protocol device. You can then use dfu tools or GUIs to upgrade the iron using the `.bin` files that are posted to the releases page.
To change to dapboot based alternative bootloader, you need to flash the hex file from [here](https://github.com/eDesignOSS/ts100-bl-flasher/releases).
`ts100-stockbl.hex` will reflash the stock bootloader, `ts100-dapboot.hex` will flash the new dapboot based usb bootloader.
To install this alternative bootloader, follow the instructions [here](https://github.com/Ralim/IronOS-dfu/blob/mainline/docs/Bootloader.md).
Note that this is only recommended for users who know what they are doing. If you don't understand how this works, please don't flash this.

View File

@@ -5,4 +5,4 @@
- Accelerometer is the MSA301, this is mounted roughly in the middle of the unit
- USB-PD is using the FUSB302
- The hardware I2C bus on PB6/7 is used for the MSA301 and FUSB302
- The OLED is the same SSD1306 as everything else, but its on a bit-banged bus
- The OLED is the same SSD1306 as everything else, but its on a bit-banged bus

View File

@@ -16,7 +16,7 @@ If your iron is new, there is a slim chance your accelerometer may be DOA and ne
## No USB-PD IC detected
Generally, this means either something went very awry in the firmware or the chip is not answering as would normally be expected. Try rolling back to an earlier release to confirm if the issue still persists then the device may need repair. If you have some form of seller protection/support you most likely want to reach out to this to be safe. If you don't, you can always attempt to replace the IC yourself. As of writing both the TS80P and Pinecil use the FUSB302.
Generally, this means either something went very awry in the firmware, or the chip is not answering as would normally be expected. Try rolling back to an earlier release to confirm if the issue still persists then the device may need repair. If you have some form of seller protection/support, you most likely want to reach out to this to be safe. If you don't, you can always attempt to replace the IC yourself. As of writing both the TS80P and Pinecil use the FUSB302.
**Note this warning will only be shown the first few times until settings are reset**

View File

@@ -1,7 +1,7 @@
# Startup Logos
This firmware supports a user created bootup logo.
By default there is _not_ one included in the firmware, as this means that once flashed they generally stay.
By default, there is _not_ one included in the firmware, as this means that once flashed they generally stay.
## Generating the Logo files
@@ -27,7 +27,7 @@ Run `python3 img2logo.py --help` to see available options.
### Miniware (TS100/TS80/TS80P)
Upload the HEX file to the iron in DFU mode and, if the file's extension changes to .RDY, your custom splash screen should show up on startup.
You perform this the same way as if you were flashing a new firmware, and all of the existing notes around this apply.
You perform this the same way as if you were flashing a new firmware, and all the existing notes around this apply.
If you have flashed the `IronOS-dfu` alternative bootloader, you should use the `.dfu` files instead

View File

@@ -14,7 +14,7 @@ Holding the button at the front of the iron will enter boost mode (if enabled).
This menu allows you to cycle through all the options and set their values.
The button near the USB cycles through the options, and the one near the tip changes the selected option.
Note that settings are not saved until you exit the menu.
If you leave the unit alone (ie don't press any buttons) on a setting, after 3 seconds the screen will scroll a rough description of the setting.
If you leave the unit alone (i.e., don't press any buttons) on a setting, after 3 seconds the screen will scroll a rough description of the setting.
The menu is arranged so that the most often used settings are first.
With submenus being selected to enter using the front button (as if you were going to change the setting).
@@ -41,7 +41,7 @@ To calibrate your iron:
Some tips will have an offset on their readings, to calibrate this out perform the following steps:
1. Connect power to your iron
2. Make sure the tip is at room temperature (ie. wait for a fair while after using the iron before calibration)
2. Make sure the tip is at room temperature (i.e., wait for a fair while after using the iron before calibration)
3. Enter the settings menu
4. Scroll down to the advanced menu, and then the temperature calibration
5. Press the button to change the option (tip button)
@@ -54,6 +54,6 @@ Some tips will have an offset on their readings, to calibrate this out perform t
### Boost mode
This allows you to change the front key (one near the tip) to become a boost button when you hold it for > 2 seconds. This allows you to set this button to change the soldering temperature for short periods. For example when soldering a big joint and you want to boost the temperature a bit.
This allows you to change the front key (one near the tip) to become a boost button when you hold it for > 2 seconds. This allows you to set this button to change the soldering temperature for short periods. For example, when soldering a big joint and you want to boost the temperature a bit.
The boost temperature is set in the settings menu.

View File

@@ -13,7 +13,7 @@ Combining these two gives the common equation, power is `Volts (V) squared / Res
The resistance of the tip is fixed, ~7.5 ohms for the TS100/Pinecil and ~4.5 ohms for the TS80(P).
This means that for both irons, the power delivered to the soldering tip is proportional to the voltage used, squared.
This is why the TS100 performs poorly when run off 12 V power supplies.
Therefore the TS100 performs poorly when run off 12 V power supplies.
## Output Control & Regulation

View File

@@ -17,7 +17,7 @@ If you can open up your iron, give it a good look at all the connection points,
If you are finding the tip is reading high; the first fields to check in the Debug menu are `RTip` and `CHan`.
- `RTip` is the raw tip reading in μV; at cool this should be around 700-1000 for Larger tips and ~1500 for smaller tips (TS80's)
- `RTip` is the raw tip reading in μV; at cool this should be around 700-1000 for larger tips and ~1500 for smaller tips (TS80's)
- `CHan` is the temperature of the temperature sensor on the PCB in degrees Celsius \* 10. So 29 °C ambient should read as 290
### RTip is out of spec

View File

@@ -20,7 +20,9 @@ This project is considered feature complete for use as a soldering iron, _so ple
_This firmware does **NOT** support the USB port while running for changing settings. This is done through the onscreen menu only. Logos are edited using the tool or python script and uploaded in DFU mode._
To get started with this firmware, please jump over to [here](Documentation/GettingStarted.md).
## Getting Started
To get started with IronOS firmware, please jump to [Getting Started Guide](Documentation/GettingStarted.md).
But the [TL;DR](https://www.merriam-webster.com/dictionary/TL%3BDR) is to press the button near the front of the iron to heat up. Use the button near the back of the iron to enter the settings menu.
Long hold the rear button in soldering mode to exit back to the start screen.

View File

@@ -120,9 +120,6 @@ def get_constants(build_version: str) -> List[Tuple[str, str]]:
def get_debug_menu() -> List[str]:
return [
datetime.today().strftime("%d-%m-%y"),
"HW G ",
"HW M ",
"HW P ",
"Time ",
"Move ",
"RTip ",
@@ -131,7 +128,11 @@ def get_debug_menu() -> List[str]:
"Vin ",
"ACC ",
"PWR ",
"ID ",
"Max ",
"HW G ",
"HW M ",
"HW P ",
"Hall ",
]
@@ -429,7 +430,24 @@ def get_font_map_per_font(text_list: List[str], fonts: List[str]) -> FontMapsPer
def get_forced_first_symbols() -> List[str]:
forced_first_symbols = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
forced_first_symbols = [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"a",
"b",
"c",
"d",
"e",
"f",
]
return forced_first_symbols

View File

@@ -109,7 +109,7 @@
},
"CooldownBlink": {
"text2": ["Мігценне t°", "пры астуджэнні"],
"desc": "Міргаць тэмпературай на экране астуджэння, пакуль джага яшчэ гарачае"
"desc": "Міргаць тэмпературай на экране астуджэння, пакуль джала яшчэ гарачае"
},
"TemperatureCalibration": {
"text2": ["Каліброўка", "тэмпературы"],
@@ -157,7 +157,7 @@
},
"PowerPulsePower": {
"text2": ["Сіла імп.", "сілкав. Вт"],
"desc": "Сіла імпульса щтрымливаючага ад сну павербанку ці іншай крыніцы сілкавання"
"desc": "Сіла імпульса ўтрымливаючага ад сну павербанку ці іншай крыніцы сілкавання"
},
"HallEffSensitivity": {
"text2": ["Эфект Хола", "адчувальнасць"],
@@ -177,7 +177,7 @@
},
"AnimSpeed": {
"text2": ["Хуткасць", "анімацыі"],
"desc": "Хуткасць анімацыі гузікаў у галоўным меню (Мілісекунды) (А=Адключана | Н=Нізкі | С=Сярэдні | В=Высокі)"
"desc": "Хуткасць анімацыі гузікаў у галоўным меню (Мілісекунды) (А=Адключана | Н=Нізкая | С=Сярэдняя | В=Высокая)"
},
"PowerPulseWait": {
"text2": ["Імпульс магутнасці", "час чакання"],
@@ -200,8 +200,8 @@
"desc": "Інвертаваць колеры OLED-экрана"
},
"LOGOTime": {
"text2": ["Boot logo", "duration"],
"desc": "Sets the duration for the boot logo (s=seconds)"
"text2": ["Лагатып загрузкі", "працягласць"],
"desc": "Усталяваць працягласць лагатыпа загрузкі (s=Секунды)"
}
}
}

View File

@@ -1,207 +1,339 @@
{
"languageCode": "CS",
"languageLocalName": "Český",
"fonts": ["ascii_basic", "latin_extended"],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Ujistěte se, že hrot má pokojovou teplotu!",
"SettingsResetWarning": "Opravdu chcete resetovat zařízení do továrního nastavení?",
"UVLOWarningString": "Nízké DC",
"UndervoltageString": "! Nízké napětí !",
"InputVoltageString": "Napětí: ",
"SleepingSimpleString": "Zzz ",
"SleepingAdvancedString": "Režim spánku...",
"SleepingTipAdvancedString": "Hrot:",
"OffString": "Vyp"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": ["Tov. nas. obnov.", ""],
"NoAccelerometerMessage": ["No accelerometer", "detected!"],
"NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"],
"LockingKeysString": "LOCKED",
"UnlockingKeysString": "UNLOCKED",
"WarningKeysLockedString": "!LOCKED!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
},
"characters": {
"SettingRightChar": "P",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "O",
"SettingSlowChar": "P",
"SettingMediumChar": "M",
"SettingFastChar": "R",
"SettingStartNoneChar": "O",
"SettingStartSolderingChar": "P",
"SettingStartSleepChar": "S",
"SettingStartSleepOffChar": "M",
"SettingSensitivityOff": "O",
"SettingSensitivityLow": "L",
"SettingSensitivityMedium": "M",
"SettingSensitivityHigh": "H",
"SettingLockDisableChar": "D",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "F"
},
"menuGroups": {
"PowerMenu": {
"text2": ["Power", "settings"],
"desc": "Power settings"
},
"SolderingMenu": {
"text2": ["Pájecí", "nastavení"],
"desc": "Nastavení pájení (boost, auto start...)."
},
"PowerSavingMenu": {
"text2": ["Režim", "spánku"],
"desc": "Nastavení režimu spánku, automatického vypnutí..."
},
"UIMenu": {
"text2": ["Uživatelské", "rozhraní"],
"desc": "Nastavení uživatelského rozhraní."
},
"AdvancedMenu": {
"text2": ["Pokročilé", "volby"],
"desc": "Pokročilé volby (detailní obrazovky, kalibrace, tovární nastavení...)."
}
},
"menuOptions": {
"DCInCutoff": {
"text2": ["Zdroj", "napájení"],
"desc": "Při nižším napětí ukončí pájení (DC=10V | ?S=?x3,3V pro LiPo, LiIon...)."
},
"SleepTemperature": {
"text2": ["Teplota v", "r. spánku"],
"desc": "Teplota v režimu spánku."
},
"SleepTimeout": {
"text2": ["Čas do", "r. spánku"],
"desc": "Čas do režimu spánku (Minut | Sekund)."
},
"ShutdownTimeout": {
"text2": ["Čas do", "vypnutí"],
"desc": "Čas do automatického vypnutí (Minut)."
},
"MotionSensitivity": {
"text2": ["Citlivost", "det. pohybu"],
"desc": "Citlivost detekce pohybu (0=Vyp | 1=Min | ... | 9=Max)."
},
"TemperatureUnit": {
"text2": ["Jednotky", "teploty"],
"desc": "Jednotky měření teploty (C=Celsius | F=Fahrenheit)."
},
"AdvancedIdle": {
"text2": ["Podrobnosti", "na vých. obr."],
"desc": "Zobrazit podrobnosti na výchozí obrazovce?"
},
"DisplayRotation": {
"text2": ["Orientace", "obrazovky"],
"desc": "Orientace obrazovky (P=Pravák | L=Levák | A=Auto)."
},
"BoostTemperature": {
"text2": ["Teplota v", "r. boost"],
"desc": "Teplota v režimu boost."
},
"AutoStart": {
"text2": ["Automatický", "start"],
"desc": "Při startu ihned nahřát hrot? (O=Pryč | P=Pájení | S=Spát | M=Spát teplota místnosti)"
},
"CooldownBlink": {
"text2": ["Blikáni při", "chladnutí"],
"desc": "Blikání teploty při chladnutí, dokud je hrot horký?"
},
"TemperatureCalibration": {
"text2": ["Kalibrovat", "teplotu?"],
"desc": "Kalibrace měření teploty."
},
"SettingsReset": {
"text2": ["Tovární", "nastavení?"],
"desc": "Obnovení továrního nastavení."
},
"VoltageCalibration": {
"text2": ["Kalibrovat", "vstupní napětí?"],
"desc": "Kalibrace vstupního napětí. Tlačítky uprav, podržením potvrď."
},
"AdvancedSoldering": {
"text2": ["Podrobnosti", "při pájení"],
"desc": "Zobrazit podrobnosti při pájení?"
},
"ScrollingSpeed": {
"text2": ["Rychlost", "popisků"],
"desc": "Rychlost posuvu popisků podobných tomuto (P=Pomalu | R=Rychle)"
},
"QCMaxVoltage": {
"text2": ["Výkon", "ve wattech"],
"desc": "Výkon použítého napájecího adaptéru ve wattech."
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
},
"PowerLimit": {
"text2": ["Omezení", "Výkonu"],
"desc": "Maximální příkon (Watty)"
},
"ReverseButtonTempChange": {
"text2": ["Prohodit", "tl. +-?"],
"desc": "Prohodí tlačítka plus a minus pro změnu teploty hrotu."
},
"TempChangeShortStep": {
"text2": ["Krok teploty", "krátký?"],
"desc": "Velikost skoku při změně teploty krátkým stiskem tlačítka!"
},
"TempChangeLongStep": {
"text2": ["Krok teploty", "dlouhý?"],
"desc": "Velikost skoku při změně teploty dlouhým stiskem tlačítka!"
},
"PowerPulsePower": {
"text2": ["Intenzita", "Výkon. pulsu"],
"desc": "Puls pro udržení zařízení v chodu (kvůli power bankám)."
},
"HallEffSensitivity": {
"text2": ["Hall sensor", "sensitivity"],
"desc": "Sensitivity of the Hall effect sensor to detect sleep (0=Vyp | 1=Min | ... | 9=Max)"
},
"LockingMode": {
"text2": ["Allow locking", "buttons"],
"desc": "While soldering, hold down both buttons to toggle locking them (D=disable | B=boost mode only | F=full locking)"
},
"MinVolCell": {
"text2": ["Minimum", "voltage"],
"desc": "Minimum allowed voltage per cell (3S: 3 - 3,7V | 4-6S: 2,4 - 3,7V)"
},
"AnimLoop": {
"text2": ["Anim.", "loop"],
"desc": "Loop icon animations in main menu"
},
"AnimSpeed": {
"text2": ["Anim.", "speed"],
"desc": "Pace of icon animations in menu (O=off | P=slow | M=medium | R=fast)"
},
"PowerPulseWait": {
"text2": ["Power pulse", "delay"],
"desc": "Delay before keep-awake-pulse is triggered (x 2,5s)"
},
"PowerPulseDuration": {
"text2": ["Power pulse", "duration"],
"desc": "Keep-awake-pulse duration (x 250ms)"
},
"LanguageSwitch": {
"text2": ["Řeč:", " CS Český"],
"desc": ""
},
"Brightness": {
"text2": ["Screen", "brightness"],
"desc": "Adjust the brightness of the OLED screen"
},
"ColourInversion": {
"text2": ["Invert", "screen"],
"desc": "Invert the colours of the OLED screen"
},
"LOGOTime": {
"text2": ["Boot logo", "duration"],
"desc": "Sets the duration for the boot logo (s=seconds)"
}
}
}
"languageCode": "CS",
"languageLocalName": "Český",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Ujistěte se, že hrot má pokojovou teplotu!",
"SettingsResetWarning": "Opravdu chcete resetovat zařízení do továrního nastavení?",
"UVLOWarningString": "Nízké DC",
"UndervoltageString": "Nízké napětí",
"InputVoltageString": "Napětí: ",
"SleepingSimpleString": "Zzz ",
"SleepingAdvancedString": "Režim spánku...",
"SleepingTipAdvancedString": "Hrot:",
"OffString": "Vyp"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
"Nějaká nastavení",
"byla změněna!"
],
"NoAccelerometerMessage": [
"Akcelerometr",
"nebyl detekován!"
],
"NoPowerDeliveryMessage": [
"Žádný IO USB-PD",
"nebyl detekován!"
],
"LockingKeysString": "ZAMČENO",
"UnlockingKeysString": "ODEMČENO",
"WarningKeysLockedString": "ZAMČENO!",
"WarningThermalRunaway": [
"Teplotní",
"Ochrana"
]
},
"characters": {
"SettingRightChar": "P",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "D",
"SettingSlowChar": "P",
"SettingMediumChar": "S",
"SettingFastChar": "R",
"SettingStartNoneChar": "V",
"SettingStartSolderingChar": "P",
"SettingStartSleepChar": "S",
"SettingStartSleepOffChar": "M",
"SettingSensitivityOff": "O",
"SettingSensitivityLow": "M",
"SettingSensitivityMedium": "S",
"SettingSensitivityHigh": "V",
"SettingLockDisableChar": "Z",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "U"
},
"menuGroups": {
"PowerMenu": {
"text2": [
"Napájecí",
"nastavení"
],
"desc": "Nastavení napájení"
},
"SolderingMenu": {
"text2": [
"Pájecí",
"nastavení"
],
"desc": "Nastavení pájení"
},
"PowerSavingMenu": {
"text2": [
"Režim",
"spánku"
],
"desc": "Nastavení úspory energie"
},
"UIMenu": {
"text2": [
"Uživatelské",
"rozhraní"
],
"desc": "Nastavení uživatelského rozhraní"
},
"AdvancedMenu": {
"text2": [
"Pokročilá",
"nastavení"
],
"desc": "Pokročilá nastavení"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"Zdroj",
"napájení"
],
"desc": "Při nižším napětí ukončit pájení (DC 10V) (S 3,3V na článek, zakázat omezení napájení)."
},
"SleepTemperature": {
"text2": [
"Teplota",
"ve spánku"
],
"desc": "Teplota hrotu v režimu spánku."
},
"SleepTimeout": {
"text2": [
"Čas",
"do spánku"
],
"desc": "\"Režim spánku\" naběhne v (s=sekundách | m=minutách)"
},
"ShutdownTimeout": {
"text2": [
"Čas do",
"vypnutí"
],
"desc": "Interval automatického vypnutí (m=minut)"
},
"MotionSensitivity": {
"text2": [
"Citlivost",
"na pohyb"
],
"desc": "0=vyp | 1=nejméně citlivé | ... | 9=nejvíce citlivé"
},
"TemperatureUnit": {
"text2": [
"Jednotka",
"teploty"
],
"desc": "C=Celsius | F=Fahrenheit"
},
"AdvancedIdle": {
"text2": [
"Podrobná obr.",
"nečinnosti"
],
"desc": "Zobrazit detailní informace malým fontem na obrazovce nečinnosti"
},
"DisplayRotation": {
"text2": [
"Orientace",
"obrazovky"
],
"desc": "P=pravák | L=levák | A=automaticky"
},
"BoostTemperature": {
"text2": [
"Teplota",
"boostu"
],
"desc": "Teplota hrotu v \"režimu boost\""
},
"AutoStart": {
"text2": [
"Chování",
"při startu"
],
"desc": "V=vypnuto | P=pájecí teplota | S=spánková teplota | M=zahřát hrot po pohybu"
},
"CooldownBlink": {
"text2": [
"Blikáni při",
"chladnutí"
],
"desc": "Blikat teplotou při chladnutí dokud je hrot horký"
},
"TemperatureCalibration": {
"text2": [
"Kalibrovat",
"teplotu?"
],
"desc": "Začít kalibraci měření teploty hrotu"
},
"SettingsReset": {
"text2": [
"Obnovit tovární",
"nastavení?"
],
"desc": "Obnovit všechna nastavení na výchozí"
},
"VoltageCalibration": {
"text2": [
"Kalibrovat",
"vstupní napětí?"
],
"desc": "Začít kalibraci vstupního napětí (dlouhý stisk pro ukončení)"
},
"AdvancedSoldering": {
"text2": [
"Podrobná obr.",
"pájení"
],
"desc": "Zobrazit detailní informace malým fontem na obrazovce pájení"
},
"ScrollingSpeed": {
"text2": [
"Rychlost",
"posouvání"
],
"desc": "Rychlost posouvání popisků podobných tomuto (P=pomalu | R=rychle)"
},
"QCMaxVoltage": {
"text2": [
"Napětí",
"QC"
],
"desc": "Maximální napětí QC pro jednání páječkou"
},
"PDNegTimeout": {
"text2": [
"PD",
"timeout"
],
"desc": "Maximální prodleva při jednání PD ve 100ms krocích pro kompatibilitu s některými QC nabíječkami"
},
"PowerLimit": {
"text2": [
"Omezení",
"Výkonu"
],
"desc": "Maximální příkon páječky (W=watt)"
},
"ReverseButtonTempChange": {
"text2": [
"Prohodit",
"tl. +-?"
],
"desc": "Prohodit tlačítka pro změnu teploty"
},
"TempChangeShortStep": {
"text2": [
"Krok teploty",
"krátký?"
],
"desc": "Velikost přídavku při změně teploty krátkým stiskem tlačítka"
},
"TempChangeLongStep": {
"text2": [
"Krok teploty",
"dlouhý?"
],
"desc": "Velikost přídavku při změně teploty dlouhým stiskem tlačítka"
},
"PowerPulsePower": {
"text2": [
"Napájecí",
"pulz"
],
"desc": "Intenzita výkonu pulzu pro udržení páječky vzhůru (watt)"
},
"HallEffSensitivity": {
"text2": [
"Citlivost",
"Hall. čidla"
],
"desc": "Citlivost Hallova čidla pro detekci spánku (0=vypnuto | 1=nejméně citlivé | ... | 9=nejvíce citlivé)"
},
"LockingMode": {
"text2": [
"Povolit zamč.",
"tlačítek"
],
"desc": "Při pájení podržte obě tlačítka pro jejich zamčení (Z=zakázáno | B=pouze v režimu boost | U=úplné zamčení)"
},
"MinVolCell": {
"text2": [
"Minimální",
"napětí"
],
"desc": "Minimální dovolené napětí po článku (3S: 3 - 3,7V | 4-6S: 2,4 - 3,7V)"
},
"AnimLoop": {
"text2": [
"Anim.",
"smyčka"
],
"desc": "Animovat ikony hlavního menu ve smyčce"
},
"AnimSpeed": {
"text2": [
"Anim.",
"rychlost"
],
"desc": "Tempo animace ikon v menu (O=vypnuto | P=pomalu | S=středně | R=rychle)"
},
"PowerPulseWait": {
"text2": [
"Prodleva",
"napáj. pulzu"
],
"desc": "Prodleva než je spuštěn pulz pro udržení páječky vzhůru pulzu pro udržení páječky vzhůru (x 2,5s)"
},
"PowerPulseDuration": {
"text2": [
"Délka",
"napáj. pulzu"
],
"desc": "Délka pulzu pro udržení páječky vzhůru (x 250ms)"
},
"LanguageSwitch": {
"text2": [
"Jazyk:",
" CS Český"
],
"desc": "Současný jazyk firmwaru"
},
"Brightness": {
"text2": [
"Jas",
"obrazovky"
],
"desc": "Upravit jas OLED"
},
"ColourInversion": {
"text2": [
"Invertovat",
"obrazovku"
],
"desc": "Invertovat barvy na OLED"
},
"LOGOTime": {
"text2": [
"Trvání",
"boot loga"
],
"desc": "Nastavení doby trvání boot loga (s=sekundy)"
}
}
}

View File

@@ -1,207 +1,339 @@
{
"languageCode": "NL",
"languageLocalName": "Nederlands",
"fonts": ["ascii_basic", "latin_extended"],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Zorg ervoor dat te punt op kamertemperatuur is voor je verder gaat!",
"SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wil zetten?",
"UVLOWarningString": "DC Laag",
"UndervoltageString": "Onderspanning",
"InputVoltageString": "Input V: ",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Slaapstand...",
"SleepingTipAdvancedString": "Punt:",
"OffString": "Uit"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": ["Instellingen", "zijn gereset!"],
"NoAccelerometerMessage": ["No accelerometer", "detected!"],
"NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"],
"LockingKeysString": " GEBLOKKEERD",
"UnlockingKeysString": "GEDEBLOKKEERD",
"WarningKeysLockedString": "!GEBLOKKEERD!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
},
"characters": {
"SettingRightChar": "R",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "O",
"SettingSlowChar": "S",
"SettingMediumChar": "M",
"SettingFastChar": "F",
"SettingStartNoneChar": "F",
"SettingStartSolderingChar": "T",
"SettingStartSleepChar": "S",
"SettingStartSleepOffChar": "K",
"SettingSensitivityOff": "O",
"SettingSensitivityLow": "L",
"SettingSensitivityMedium": "M",
"SettingSensitivityHigh": "H",
"SettingLockDisableChar": "U",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "V"
},
"menuGroups": {
"PowerMenu": {
"text2": ["Power", "settings"],
"desc": "Power settings"
},
"SolderingMenu": {
"text2": ["Soldeer", "Instellingen"],
"desc": "Soldeer instellingen"
},
"PowerSavingMenu": {
"text2": ["Slaap", "Modes"],
"desc": "Stroom besparings instellingen"
},
"UIMenu": {
"text2": ["Gebruikers-", "interface"],
"desc": "Gebruikers-interface instellingen"
},
"AdvancedMenu": {
"text2": ["Geavanceerde", "Instellingen"],
"desc": "Geavanceerde Instellingen"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": ["Spannings-", "bron"],
"desc": "Spanningsbron. Stelt drempelspanning in. (DC 10V) (S 3.3V per cel)"
},
"SleepTemperature": {
"text2": ["Slaap", "temp"],
"desc": "Temperatuur in slaapstand"
},
"SleepTimeout": {
"text2": ["Slaap", "time-out"],
"desc": "Slaap time-out (Minuten | Seconden)"
},
"ShutdownTimeout": {
"text2": ["Uitschakel", "time-out"],
"desc": "Automatisch afsluiten time-out (Minuten)"
},
"MotionSensitivity": {
"text2": ["Bewegings-", "gevoeligheid"],
"desc": "Bewegingsgevoeligheid (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)"
},
"TemperatureUnit": {
"text2": ["Temperatuur", "eenheid"],
"desc": "Temperatuureenheid (C=Celsius | F=Fahrenheit)"
},
"AdvancedIdle": {
"text2": ["Gedetailleerd", "startscherm"],
"desc": "Gedetailleerde informatie weergeven in een kleiner lettertype op het startscherm."
},
"DisplayRotation": {
"text2": ["Scherm-", "oriëntatie"],
"desc": "Schermoriëntatie (R=Rechtshandig | L=Linkshandig | A=Automatisch)"
},
"BoostTemperature": {
"text2": ["Boost", "temp"],
"desc": "Temperatuur in boostmode"
},
"AutoStart": {
"text2": ["Auto", "start"],
"desc": "Breng de soldeerbout direct op temperatuur bij het opstarten. (F=Uit | T=Soldeertemperatuur | S=Slaapstand-temperatuur | K=Slaapstand kamertemperatuur)"
},
"CooldownBlink": {
"text2": ["Afkoel", "flikker"],
"desc": "Temperatuur laten flikkeren in het hoofdmenu als de soldeerpunt aan het afkoelen is."
},
"TemperatureCalibration": {
"text2": ["Calibreer", "temperatuur?"],
"desc": "Temperatuursafwijking van de soldeerpunt calibreren."
},
"SettingsReset": {
"text2": ["Instellingen", "resetten?"],
"desc": "Alle instellingen terugzetten."
},
"VoltageCalibration": {
"text2": ["Calibreer", "input-voltage?"],
"desc": "VIN Calibreren. (druk lang om te sluiten)."
},
"AdvancedSoldering": {
"text2": ["Gedetailleerd", "soldeerscherm"],
"desc": "Gedetailleerde informatie weergeven in een kleiner lettertype op het soldeerscherm."
},
"ScrollingSpeed": {
"text2": ["Scroll", "snelheid"],
"desc": "Snelheid waarmee de tekst scrolt."
},
"QCMaxVoltage": {
"text2": ["Power", "Wattage"],
"desc": "Wattage van de gebruikte voeding"
},
"PDNegTimeout": {
"text2": ["PD", "timeout"],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)"
},
"PowerLimit": {
"text2": ["Vermogen", "limiet"],
"desc": "Maximaal vermogen (Watts)"
},
"ReverseButtonTempChange": {
"text2": ["Draai", "+ - knoppen om"],
"desc": "Keer de +- knoppen om de termperatuur van de punt te regelen om."
},
"TempChangeShortStep": {
"text2": ["Temp veranderen", "kort"],
"desc": "Temperatuur verandering bij kort drukken"
},
"TempChangeLongStep": {
"text2": ["Temp veranderen", "lang"],
"desc": "Temperatuur verandering bij lang drukken"
},
"PowerPulsePower": {
"text2": ["Vermogen", "Puls W"],
"desc": "Vermogen van puls om soldeerbout aan te houden"
},
"HallEffSensitivity": {
"text2": ["Hall sensor", "sensitivity"],
"desc": "Sensitivity of the Hall effect sensor to detect sleep (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)"
},
"LockingMode": {
"text2": ["Blokkeer", "knoppen"],
"desc": "Tijdens solderen lang op beide knoppen drukken, blokkeert ze. (U=Uit | B=Alleen boost | V=Volledig blokkeren)"
},
"MinVolCell": {
"text2": ["Minimum", "voltage"],
"desc": "Minimum allowed voltage per cell (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
},
"AnimLoop": {
"text2": ["Anim.", "loop"],
"desc": "Loop icon animations in main menu"
},
"AnimSpeed": {
"text2": ["Anim.", "speed"],
"desc": "Pace of icon animations in menu (O=off | S=slow | M=medium | F=fast)"
},
"PowerPulseWait": {
"text2": ["Power pulse", "delay"],
"desc": "Delay before keep-awake-pulse is triggered (x 2.5s)"
},
"PowerPulseDuration": {
"text2": ["Power pulse", "duration"],
"desc": "Keep-awake-pulse duration (x 250ms)"
},
"LanguageSwitch": {
"text2": ["Spraak :", " NL Nederlands"],
"desc": ""
},
"Brightness": {
"text2": ["Screen", "brightness"],
"desc": "Adjust the brightness of the OLED screen"
},
"ColourInversion": {
"text2": ["Invert", "screen"],
"desc": "Invert the colours of the OLED screen"
},
"LOGOTime": {
"text2": ["Boot logo", "duration"],
"desc": "Sets the duration for the boot logo (s=seconds)"
}
}
}
{
"languageCode": "NL",
"languageLocalName": "Nederlands",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Zorg ervoor dat de punt op kamertemperatuur is voor je verder gaat!",
"SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wilt zetten?",
"UVLOWarningString": "DC Laag",
"UndervoltageString": "Onderspanning",
"InputVoltageString": "Voeding V: ",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Slaapstand...",
"SleepingTipAdvancedString": "Punt:",
"OffString": "Uit"
},
"messagesWarn": {
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
"Instellingen",
"zijn gereset!"
],
"NoAccelerometerMessage": [
"Geen accelerometer",
"gedetecteerd!"
],
"NoPowerDeliveryMessage": [
"Geen USB-PD IC ",
"gedetecteerd!"
],
"LockingKeysString": "GEBLOKKEERD",
"UnlockingKeysString": "GEDEBLOKKEERD",
"WarningKeysLockedString": "!GEBLOKKEERD!",
"WarningThermalRunaway": [
"Verwarming",
"Oncontroleerbaar"
]
},
"characters": {
"SettingRightChar": "R",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "U",
"SettingSlowChar": "L",
"SettingMediumChar": "G",
"SettingFastChar": "S",
"SettingStartNoneChar": "U",
"SettingStartSolderingChar": "G",
"SettingStartSleepChar": "S",
"SettingStartSleepOffChar": "B",
"SettingSensitivityOff": "U",
"SettingSensitivityLow": "L",
"SettingSensitivityMedium": "G",
"SettingSensitivityHigh": "H",
"SettingLockDisableChar": "U",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "V"
},
"menuGroups": {
"PowerMenu": {
"text2": [
"Voeding",
"instellingen"
],
"desc": "Voeding instellingen"
},
"SolderingMenu": {
"text2": [
"Soldeer",
"instellingen"
],
"desc": "Soldeer instellingen"
},
"PowerSavingMenu": {
"text2": [
"Slaap",
"Modes"
],
"desc": "Stroom besparings instellingen"
},
"UIMenu": {
"text2": [
"Weergave",
"instellingen"
],
"desc": "Weergave instellingen"
},
"AdvancedMenu": {
"text2": [
"Geavanceerde",
"instellingen"
],
"desc": "Geavanceerde instellingen"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"Spannings-",
"bron"
],
"desc": "Spanningsbron. Stelt drempelspanning in. (DC 10V) (S 3.3V per cel)"
},
"SleepTemperature": {
"text2": [
"Slaap",
"temp"
],
"desc": "Punt temperatuur in slaapstand"
},
"SleepTimeout": {
"text2": [
"Slaap",
"time-out"
],
"desc": "Tijd voordat slaapmodus wordt geactiveerd (S=seconden | M=minuten)"
},
"ShutdownTimeout": {
"text2": [
"Uitschakel",
"time-out"
],
"desc": "Tijd voordat soldeerbout automatisch uitschakelt (M=minuten)"
},
"MotionSensitivity": {
"text2": [
"Bewegings-",
"gevoeligheid"
],
"desc": "Bewegingsgevoeligheid (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)"
},
"TemperatureUnit": {
"text2": [
"Temperatuur",
"eenheid"
],
"desc": "Temperatuureenheid (C=Celsius | F=Fahrenheit)"
},
"AdvancedIdle": {
"text2": [
"Gedetailleerd",
"startscherm"
],
"desc": "Gedetailleerde informatie weergeven in een kleine letters op het startscherm."
},
"DisplayRotation": {
"text2": [
"Scherm-",
"oriëntatie"
],
"desc": "Schermoriëntatie (R=Rechtshandig | L=Linkshandig | A=Automatisch)"
},
"BoostTemperature": {
"text2": [
"Boost",
"temp"
],
"desc": "Punt temperatuur in boostmode"
},
"AutoStart": {
"text2": [
"Opstart",
"gedrag"
],
"desc": "Gedrag bij opstarten (U=Uit | G=Gebruiks-temperatuur | S=Slaapstand-temperatuur tot beweging | B=Uit tot beweging)"
},
"CooldownBlink": {
"text2": [
"Afkoel",
"flitsen"
],
"desc": "Temperatuur laten flitsen in het hoofdmenu zo lang de punt nog warm is"
},
"TemperatureCalibration": {
"text2": [
"Kalibreer",
"temperatuur?"
],
"desc": "Start punt temperatuur-kalibratie"
},
"SettingsReset": {
"text2": [
"Instellingen",
"resetten?"
],
"desc": "Alle instellingen terugzetten naar fabrieksinstellingen"
},
"VoltageCalibration": {
"text2": [
"Kalibreer",
"input-voltage?"
],
"desc": "Start VIN Kalibratie (druk lang om te sluiten)"
},
"AdvancedSoldering": {
"text2": [
"Gedetailleerd",
"soldeerscherm"
],
"desc": "Gedetailleerde informatie weergeven in een kleiner lettertype op het soldeerscherm"
},
"ScrollingSpeed": {
"text2": [
"Scroll",
"snelheid"
],
"desc": "Snelheid waarmee de tekst scrolt (S=Snel | L=Langzaam)"
},
"QCMaxVoltage": {
"text2": [
"QC",
"Voltage"
],
"desc": "Maximaal QC voltage dat gevraagd mag worden"
},
"PDNegTimeout": {
"text2": [
"PD",
"timeout"
],
"desc": "PD afstemmingsduur in stappen van 100ms (voor compatibiliteit met sommige QC laders)"
},
"PowerLimit": {
"text2": [
"Vermogen",
"limiet"
],
"desc": "Maximaal vermogen (W=Watt)"
},
"ReverseButtonTempChange": {
"text2": [
"Draai",
"+ - knoppen om"
],
"desc": "Keer de +- knoppen van de temperatuurregeling om"
},
"TempChangeShortStep": {
"text2": [
"Temp veranderen",
"kort"
],
"desc": "Temperatuur verandering bij kort drukken"
},
"TempChangeLongStep": {
"text2": [
"Temp veranderen",
"lang"
],
"desc": "Temperatuur verandering bij lang drukken"
},
"PowerPulsePower": {
"text2": [
"Stroom",
"Puls"
],
"desc": "Intensiteit van stroompuls om voeding aan te houden (watt)"
},
"HallEffSensitivity": {
"text2": [
"Hall sensor",
"gevoeligheid"
],
"desc": "Gevoeligheid van de Hall effect sensor om naar slaapmodus te gaan (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)"
},
"LockingMode": {
"text2": [
"Knopblokkering",
"inschakelen"
],
"desc": "Tijdens solderen lang op beide knoppen drukken blokkeert de knoppen (U=Uit | B=Alleen boost mode | V=Volledig blokkeren)"
},
"MinVolCell": {
"text2": [
"Minimum",
"voltage"
],
"desc": "Minimum toegestaan voltage per cell (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
},
"AnimLoop": {
"text2": [
"Animatie",
"herhaling"
],
"desc": "Herhaal icoon animaties in hoofdmenu"
},
"AnimSpeed": {
"text2": [
"Animatie",
"snelheid"
],
"desc": "Tempo van de icoon animaties in het hoofdmenu (U=uit | L=langzaam | G=gemiddeld | S=snel)"
},
"PowerPulseWait": {
"text2": [
"Stroompuls",
"interval"
],
"desc": "Tijdsduur tussen voeding wakker-blijf-pulsen (x 2.5s)"
},
"PowerPulseDuration": {
"text2": [
"Power pulse",
"duur"
],
"desc": "Duur van voeding-wakker-blijf-pulsen (x 250ms)"
},
"LanguageSwitch": {
"text2": [
"Taal:",
" NL Nederlands"
],
"desc": "Huidige firmware taal"
},
"Brightness": {
"text2": [
"Scherm",
"helderheid"
],
"desc": "Pas helderheid van het OLED scherm aan"
},
"ColourInversion": {
"text2": [
"Inverteer",
"scherm"
],
"desc": "Inverteer de kleuren van het OLED scherm"
},
"LOGOTime": {
"text2": [
"Opstart logo",
"duur"
],
"desc": "Stelt de weergaveduur van het opstartlogo in (s=seconden)"
}
}
}

View File

@@ -200,8 +200,8 @@
"desc": "Odwrócenie kolorów wyświetlacza OLED"
},
"LOGOTime": {
"text2": ["Boot logo", "duration"],
"desc": "Sets the duration for the boot logo (s=seconds)"
"text2": ["Długość wyś.", "loga"],
"desc": "Ustawia czas wyświetlania loga podczas uruchamiania (s=sekund)"
}
}
}

View File

@@ -132,8 +132,8 @@
"desc": "Скорость прокрутки текста (М=медленно | Б=быстро)"
},
"QCMaxVoltage": {
"text2": ["Максимальный", "вольтаж для QC"],
"desc": "Максимальный поддерживаемый QC вольтаж используемого источника питания"
"text2": ["Ограничение", "напряжения QC"],
"desc": "Максимальное напряжение для согласования с QC источником питания"
},
"PDNegTimeout": {
"text2": ["PD", "тайм-аут"],
@@ -196,12 +196,12 @@
"desc": "Настройки контраста/яркости OLED экрана"
},
"ColourInversion": {
"text2": ["Инверт", "экрана"],
"text2": ["Инверсия", "экрана"],
"desc": "Инвертировать цвета на OLED экране"
},
"LOGOTime": {
"text2": ["Boot logo", "duration"],
"desc": "Sets the duration for the boot logo (s=seconds)"
"text2": ["Длительность", "показа логотипа"],
"desc": "Длительность отображения логотипа (в секундах)"
}
}
}

View File

@@ -0,0 +1,9 @@
# which compilers to use for C and C++
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(CMAKE_C_COMPILER arm-none-eabi-gcc CACHE INTERNAL "C Compiler")
set(CMAKE_CXX_COMPILER arm-none-eabi-g++ CACHE INTERNAL "C++ Compiler")
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc -x assembler-with-cpp CACHE INTERNAL "ASM Compiler")
set(CMAKE_OBJCOPY arm-none-eabi-objcopy CACHE INTERNAL "Object Copy")
set(CMAKE_OBJDUMP arm-none-eabi-objdump CACHE INTERNAL "Object Dump")

View File

@@ -0,0 +1,6 @@
# core flags
set(CORE_FLAGS "-march=rv32imac -mabi=ilp32 -mcmodel=medany -fsigned-char -fno-builtin -nostartfiles" CACHE INTERNAL "CPU flags")
add_definitions(${CORE_FLAGS})
# link with linker file
target_link_libraries(${elf_file} PUBLIC -T ${CMAKE_CURRENT_SOURCE_DIR}/linkers/gd32vf103.ld)

View File

@@ -0,0 +1,9 @@
# which compilers to use for C and C++
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(CMAKE_C_COMPILER riscv-none-elf-gcc CACHE INTERNAL "C Compiler")
set(CMAKE_CXX_COMPILER riscv-none-elf-g++ CACHE INTERNAL "C++ Compiler")
set(CMAKE_ASM_COMPILER riscv-none-elf-gcc -x assembler-with-cpp CACHE INTERNAL "ASM Compiler")
set(CMAKE_OBJCOPY riscv-none-elf-objcopy CACHE INTERNAL "Object Copy")
set(CMAKE_OBJDUMP riscv-none-elf-objdump CACHE INTERNAL "Object Dump")

View File

@@ -0,0 +1,26 @@
# set additional for compiler and linker: optimization and generate map file
set(additional_linker_flags -Wl,-Map=${map_file},--cref,--no-warn-mismatch)
target_link_libraries(${elf_file} PRIVATE ${additional_linker_flags})
# remove unused sections
target_link_libraries(${elf_file} PUBLIC "-Wl,--gc-sections -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--undefined=vTaskSwitchContext -Wl,--undefined=pxCurrentTCB --specs=nosys.specs -Wl,--print-memory-usage -flto")
set(TARGET_FLAGS "-DMODEL_${MODEL}")
set(OPTIM_FLAGS "-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -ffreestanding -fno-common")
message(ERROR "flags >${CORE_FLAGS}<")
# compiler: language specific flags
set(CMAKE_C_FLAGS " ${CORE_FLAGS} ${OPTIM_FLAGS} ${TARGET_FLAGS} -fno-builtin -Wall -std=gnu11 -fdata-sections -ffunction-sections -g3 " CACHE INTERNAL "c compiler flags")
set(CMAKE_CXX_FLAGS " ${CORE_FLAGS} ${OPTIM_FLAGS} ${TARGET_FLAGS} -fno-rtti -fno-exceptions -fno-builtin -Wall -std=gnu++11 -fdata-sections -ffunction-sections -g -ggdb3" CACHE INTERNAL "cxx compiler flags")
set(CMAKE_ASM_FLAGS " ${CORE_FLAGS} ${OPTIM_FLAGS} ${TARGET_FLAGS} -g -ggdb3 -D__USES_CXX" CACHE INTERNAL "asm compiler flags")
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View File

@@ -0,0 +1,6 @@
# core flags
set(CORE_FLAGS "-mthumb -mcpu=cortex-m3 -mlittle-endian -mfloat-abi=soft" CACHE INTERNAL "CPU flags")
add_definitions(${CORE_FLAGS})
# link with linker file
target_link_libraries(${elf_file} PUBLIC -T ${CMAKE_CURRENT_SOURCE_DIR}/linkers/stm32f103.ld)

87
source/CMakeLists.txt Normal file
View File

@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.23)
set(application_name "${MODEL}_${LANG}")
set(elf_file ${application_name}.elf)
set(bin_file ${application_name}.bin)
set(hex_file ${application_name}.hex)
set(map_file ${application_name}.map)
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake")
if (MODEL STREQUAL TS100 OR MODEL STREQUAL TS80 OR MODEL STREQUAL TS80P)
set(CMAKE_TOOLCHAIN_FILE "CMake/arm-gcc.cmake" CACHE PATH "toolchain file")
include(${CMAKE_TOOLCHAIN_FILE})
elseif(MODEL STREQUAL Pinecil)
set(CMAKE_TOOLCHAIN_FILE "CMake/riscv-gcc.cmake" CACHE PATH "toolchain file")
include(${CMAKE_TOOLCHAIN_FILE})
elseif(MODEL STREQUAL MHP30)
set(CMAKE_TOOLCHAIN_FILE "CMake/arm-gcc.cmake" CACHE PATH "toolchain file")
include(${CMAKE_TOOLCHAIN_FILE})
else()
message(FATAL_ERROR "You must specify a model")
endif()
# Export compile commands for IDE's
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#add_compile_options( -Wall -Werror)
project(IronOS
LANGUAGES C CXX ASM
)
#Setup outputs
project (${application_name} C CXX ASM)
# add sources to elf file
file(WRITE null.cpp "")
add_executable(${elf_file}
null.cpp
)
include_directories(
Core
Middlewares
)
add_subdirectory(Core)
add_subdirectory(Middlewares)
target_link_libraries(${elf_file} PRIVATE BSP mainSource threads FreeRTOS languages BSPImplementation drivers USBPDLib)
if (MODEL STREQUAL TS100 OR MODEL STREQUAL TS80 OR MODEL STREQUAL TS80P)
include(stm32f1)
elseif(MODEL STREQUAL Pinecil)
include(gd32vf1)
elseif(MODEL STREQUAL MHP30)
include(stm32f1)
else()
message(FATAL_ERROR "You must specify a model")
endif()
include(shared-compiler-settings)
# set additional for compiler and linker: optimization and generate map file
set(additional_compiler_flags ${opt_level})
set(additional_linker_flags -Wl,-Map=${map_file},--cref,--no-warn-mismatch)
target_compile_options(${elf_file} PRIVATE ${additional_compiler_flags})
target_link_libraries(${elf_file} PRIVATE ${additional_linker_flags})
# remove unused sections
# create binary and hex files
add_custom_target(${hex_file} DEPENDS ${elf_file} COMMAND ${CMAKE_OBJCOPY} -O ihex ${elf_file} ${hex_file})
add_custom_target(${bin_file} DEPENDS ${elf_file} COMMAND ${CMAKE_OBJCOPY} -O binary ${elf_file} ${bin_file})

View File

@@ -3,7 +3,6 @@
#include "BSP_Power.h"
#include "BSP_QC.h"
#include "Defines.h"
#include "configuration.h"
#include <stdbool.h>
#include <stdint.h>
/*
@@ -74,6 +73,9 @@ void log_system_state(int32_t PWMWattsx10);
// Returns true if the tip is disconnected
bool isTipDisconnected();
// Return hardware unique ID if possible
uint64_t getDeviceID();
// Status LED controls
enum StatusLED {
@@ -86,6 +88,10 @@ enum StatusLED {
};
void setStatusLED(const enum StatusLED state);
// preStartChecks are run until they return 0
// By the PID, after each ADC sample comes in
// For example, on the MHP30 this is used to figure out the resistance of the hotplate
uint8_t preStartChecks();
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,20 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(sources
BSP_Common.c
)
add_library(BSP ${sources})
target_include_directories(BSP PUBLIC .)
target_link_libraries(BSP PUBLIC FreeRTOS)
if (MODEL STREQUAL TS100 OR MODEL STREQUAL TS80 OR MODEL STREQUAL TS80P)
add_subdirectory(Miniware)
elseif(MODEL STREQUAL Pinecil)
add_subdirectory(Pine64)
elseif(MODEL STREQUAL MHP30)
add_subdirectory(MHP30)
else()
message(FATAL_ERROR "You must specify a model")
endif()

View File

@@ -13,13 +13,15 @@
#include <IRQ.h>
WS2812<GPIOA_BASE, WS2812_Pin, 1> ws2812;
volatile uint16_t PWMSafetyTimer = 0;
volatile uint8_t pendingPWM = 0;
uint16_t totalPWM = 255;
const uint16_t powerPWM = 255;
volatile uint16_t PWMSafetyTimer = 0;
volatile uint8_t pendingPWM = 0;
uint16_t totalPWM = 255;
const uint16_t powerPWM = 255;
uint16_t tipSenseResistancex10Ohms = 0;
volatile bool tipMeasurementOccuring = false;
history<uint16_t, PID_TIM_HZ> rawTempFilter = {{0}, 0, 0};
history<uint16_t, PID_TIM_HZ> rawTempFilter = {{0}, 0, 0};
void resetWatchdog() { HAL_IWDG_Refresh(&hiwdg); }
void resetWatchdog() { HAL_IWDG_Refresh(&hiwdg); }
#ifdef TEMP_NTC
// Lookup table for the NTC
@@ -208,7 +210,8 @@ uint16_t getHandleTemperature(uint8_t sample) {
uint16_t getTipInstantTemperature() { return getADC(2); }
uint16_t getTipRawTemp(uint8_t refresh) {
if (refresh) {
if (refresh && (tipMeasurementOccuring == false)) {
uint16_t lastSample = getTipInstantTemperature();
rawTempFilter.update(lastSample);
return lastSample;
@@ -348,69 +351,82 @@ void setPlatePullup(bool pullingUp) {
HAL_GPIO_Init(PLATE_SENSOR_PULLUP_GPIO_Port, &GPIO_InitStruct);
}
uint16_t tipSenseResistancex10Ohms = 0;
bool isTipDisconnected() {
static bool lastTipDisconnectedState = true;
static uint16_t adcReadingPD1Set = 0;
static TickType_t lastMeas = 0;
void performTipMeasurementStep(bool start) {
static uint16_t adcReadingPD1Set = 0;
static TickType_t lastMeas = 0;
// Inter state that performs the steps to measure the resistor on the tip
// Return 1 if a measurement is ongoing
// We want to perform our startup measurements of the tip resistance until we detect one fitted
// Step 1; if not setup, we turn on pullup and then wait
if (tipMeasurementOccuring == false && (start || tipSenseResistancex10Ohms == 0 || lastMeas == 0)) {
tipMeasurementOccuring = true;
tipSenseResistancex10Ohms = 0;
lastMeas = xTaskGetTickCount();
adcReadingPD1Set = 0;
setPlatePullup(true);
return;
}
// Wait 100ms for settle time
if ((xTaskGetTickCount() - lastMeas) < (TICKS_100MS)) {
return;
}
lastMeas = xTaskGetTickCount();
// We are sensing the resistance
if (adcReadingPD1Set == 0) {
// We will record the reading for PD1 being set
adcReadingPD1Set = getADC(3);
setPlatePullup(false);
return;
}
// Taking reading two
uint16_t adcReadingPD1Cleared = getADC(3);
uint32_t a = ((int)adcReadingPD1Set - (int)adcReadingPD1Cleared);
a *= 10000;
uint32_t b = ((int)adcReadingPD1Cleared + (32768 - (int)adcReadingPD1Set));
if (b) {
tipSenseResistancex10Ohms = a / b;
} else {
tipSenseResistancex10Ohms = adcReadingPD1Set = lastMeas = 0;
}
if (tipSenseResistancex10Ohms > 1100 || tipSenseResistancex10Ohms < 900) {
tipSenseResistancex10Ohms = 0; // out of range
adcReadingPD1Set = 0;
lastMeas = 0;
return;
}
tipMeasurementOccuring = false;
}
bool isTipDisconnected() {
static bool lastDisconnectedState = false;
// For the MHP30 we want to include a little extra logic in here
// As when the tip is first connected we want to measure the ~100 ohm resistor on the base of the tip
// And likewise if its removed we want to clear that measurement
/*
* plate_sensor_res = ((adc5_value_PD1_set - adc5_value_PD1_cleared) / (adc5_value_PD1_cleared + 4096 - adc5_value_PD1_set)) * 1000.0;
* */
bool tipDisconnected = getADC(2) > (4090 * 8);
// We have to handle here that this ^ will trip while measuring the gain resistor
if (xTaskGetTickCount() - lastMeas < (TICKS_100MS * 2 + (TICKS_100MS / 2))) {
tipDisconnected = false;
if (tipMeasurementOccuring) {
performTipMeasurementStep(false);
return true; // We fake no tip disconnection during the measurement cycle to mask it
}
if (tipDisconnected != lastTipDisconnectedState) {
if (tipDisconnected) {
// Tip is now disconnected
tipSenseResistancex10Ohms = 0; // zero out the resistance
adcReadingPD1Set = 0;
lastMeas = 0;
}
lastTipDisconnectedState = tipDisconnected;
// If we are too close to the top, most likely disconnected tip
bool tipDisconnected = getTipInstantTemperature() > (4090 * 8);
if (tipDisconnected == false && lastDisconnectedState == true) {
// Tip is now disconnected
performTipMeasurementStep(true);
}
if (!tipDisconnected) {
if (tipSenseResistancex10Ohms == 0) {
if (lastMeas == 0) {
lastMeas = xTaskGetTickCount();
setPlatePullup(true);
} else if (xTaskGetTickCount() - lastMeas > (TICKS_100MS)) {
lastMeas = xTaskGetTickCount();
// We are sensing the resistance
if (adcReadingPD1Set == 0) {
// We will record the reading for PD1 being set
adcReadingPD1Set = getADC(3);
setPlatePullup(false);
} else {
// We have taken reading one
uint16_t adcReadingPD1Cleared = getADC(3);
uint32_t a = ((int)adcReadingPD1Set - (int)adcReadingPD1Cleared);
a *= 10000;
uint32_t b = ((int)adcReadingPD1Cleared + (32768 - (int)adcReadingPD1Set));
if (b) {
tipSenseResistancex10Ohms = a / b;
} else {
tipSenseResistancex10Ohms = adcReadingPD1Set = lastMeas = 0;
}
if (tipSenseResistancex10Ohms > 1100 || tipSenseResistancex10Ohms < 900) {
tipSenseResistancex10Ohms = 0; // out of range
adcReadingPD1Set = 0;
lastMeas = 0;
}
}
}
return true; // we fake tip being disconnected until this is measured
}
}
lastDisconnectedState = tipDisconnected;
return tipDisconnected;
}
uint8_t preStartChecks() {
performTipMeasurementStep(false);
return tipMeasurementOccuring ? 1 : 0;
}
void setBuzzer(bool on) {
if (on) {
htim3.Instance->CCR2 = 128;
@@ -455,3 +471,7 @@ void setStatusLED(const enum StatusLED state) {
setBuzzer(false);
}
}
uint64_t getDeviceID() {
//
return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32);
}

View File

@@ -10,7 +10,8 @@
#include "configuration.h"
extern uint16_t tipSenseResistancex10Ohms;
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
// For the MHP30, we are mimicing the original code and using the resistor fitted to the base of the heater head, this is measured in the isTipDisconnected() function
// For the MHP30, we are mimicing the original code and using the resistor fitted to the base of the heater head,
// this is measured at boot in pid task and in the disconnected tip check if tip is removed
if (tipSenseResistancex10Ohms > 900 && tipSenseResistancex10Ohms <= 1100) {
int32_t a = ((tipSenseResistancex10Ohms / 10) + 300) * (3300000 - tipuVDelta);
int32_t b = a / 1000000;

View File

@@ -282,4 +282,9 @@ bool isTipDisconnected() {
return tipTemp > tipDisconnectedThres;
}
void setStatusLED(const enum StatusLED state) {}
void setStatusLED(const enum StatusLED state) {}
uint8_t preStartChecks() { return 0; }
uint64_t getDeviceID() {
//
return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32);
}

View File

@@ -0,0 +1,52 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/CMSIS/Include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/CMSIS/Device)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Inc)
set(sources
BSP.cpp
flash.c
fusb_user.cpp
I2C_Wrapper.cpp
IRQ.cpp
port.c
postRTOS.cpp
Power.cpp
preRTOS.cpp
QC_GPIO.cpp
Setup.cpp
startup_stm32f103t8ux.S
stm32f1xx_hal_msp.c
stm32f1xx_hal_timebase_TIM.c
stm32f1xx_it.c
system_stm32f1xx.c
ThermoModel.cpp
# ST code
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c
)
add_library(BSPImplementation ${sources})
target_include_directories(BSPImplementation PUBLIC . ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/CMSIS/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/CMSIS/Device ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/STM32F1xx_HAL_Driver/Inc)
target_compile_definitions (BSPImplementation PUBLIC "-D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 -D ARM_MATH_CM3 -D STM32F10X_MD")
target_link_libraries(BSPImplementation PUBLIC brieflz BSP mainSource drivers)
target_link_libraries(${elf_file} PUBLIC -Wl,--defsym=__FLASH_SIZE__=64k -Wl,--defsym=__BOOTLDR_SIZE__=0x4000)
set(DEVICE_DFU_ADDRESS 0x08004000)
set(DEVICE_DFU_VID_PID 0x1209:0xDB42)

View File

@@ -6,119 +6,87 @@
*/
#ifndef BSP_MINIWARE_PINS_H_
#define BSP_MINIWARE_PINS_H_
#include "configuration.h"
#define BSP_MINIWARE_PINS_H_
#include "configuration.h"
#ifdef MODEL_TS100
#ifdef MODEL_TS100
#define KEY_B_Pin GPIO_PIN_6
#define KEY_B_GPIO_Port GPIOA
#define TMP36_INPUT_Pin GPIO_PIN_7
#define TMP36_INPUT_GPIO_Port GPIOA
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_7
#define TIP_TEMP_Pin GPIO_PIN_0
#define TIP_TEMP_GPIO_Port GPIOB
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8
#define VIN_Pin GPIO_PIN_1
#define VIN_GPIO_Port GPIOB
#define VIN_ADC1_CHANNEL ADC_CHANNEL_9
#define VIN_ADC2_CHANNEL ADC_CHANNEL_9
#define OLED_RESET_Pin GPIO_PIN_8
#define OLED_RESET_GPIO_Port GPIOA
#define KEY_A_Pin GPIO_PIN_9
#define KEY_A_GPIO_Port GPIOA
#define INT_Orientation_Pin GPIO_PIN_3
#define INT_Orientation_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_4
#define PWM_Out_GPIO_Port GPIOB
#define PWM_Out_CHANNEL TIM_CHANNEL_1
#define PWM_Out_CCR
#define INT_Movement_Pin GPIO_PIN_5
#define INT_Movement_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_6
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
#endif
#ifdef MODEL_TS80
// TS80 pin map
#define KEY_B_Pin GPIO_PIN_0
#define KEY_B_GPIO_Port GPIOB
#define TMP36_INPUT_Pin GPIO_PIN_4
#define TMP36_INPUT_GPIO_Port GPIOA
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
#define TIP_TEMP_Pin GPIO_PIN_3
#define TIP_TEMP_GPIO_Port GPIOA
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
#define KEY_B_Pin GPIO_PIN_6
#define KEY_B_GPIO_Port GPIOA
#define TMP36_INPUT_Pin GPIO_PIN_7
#define TMP36_INPUT_GPIO_Port GPIOA
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_7
#define TIP_TEMP_Pin GPIO_PIN_0
#define TIP_TEMP_GPIO_Port GPIOB
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8
#define VIN_Pin GPIO_PIN_1
#define VIN_GPIO_Port GPIOB
#define VIN_ADC1_CHANNEL ADC_CHANNEL_9
#define VIN_ADC2_CHANNEL ADC_CHANNEL_9
#define OLED_RESET_Pin GPIO_PIN_8
#define OLED_RESET_GPIO_Port GPIOA
#define KEY_A_Pin GPIO_PIN_9
#define KEY_A_GPIO_Port GPIOA
#define INT_Orientation_Pin GPIO_PIN_3
#define INT_Orientation_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_4
#define PWM_Out_GPIO_Port GPIOB
#define PWM_Out_CHANNEL TIM_CHANNEL_1
#define PWM_Out_CCR
#define INT_Movement_Pin GPIO_PIN_5
#define INT_Movement_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_6
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
#endif
#define VIN_Pin GPIO_PIN_2
#define VIN_GPIO_Port GPIOA
#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
#define OLED_RESET_Pin GPIO_PIN_15
#define OLED_RESET_GPIO_Port GPIOA
#define KEY_A_Pin GPIO_PIN_1
#define KEY_A_GPIO_Port GPIOB
#define INT_Orientation_Pin GPIO_PIN_4
#define INT_Orientation_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_6
#define PWM_Out_GPIO_Port GPIOA
#define PWM_Out_CHANNEL TIM_CHANNEL_1
#define INT_Movement_Pin GPIO_PIN_5
#define INT_Movement_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_6
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
#define SCL2_Pin GPIO_PIN_5
#define SCL2_GPIO_Port GPIOA
#define SDA2_Pin GPIO_PIN_1
#define SDA2_GPIO_Port GPIOA
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
// TS80 & TS80P pin map
#define KEY_B_Pin GPIO_PIN_0
#define KEY_B_GPIO_Port GPIOB
#define TMP36_INPUT_Pin GPIO_PIN_4
#define TMP36_INPUT_GPIO_Port GPIOA
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
#define TIP_TEMP_Pin GPIO_PIN_3
#define TIP_TEMP_GPIO_Port GPIOA
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
#endif
#ifdef MODEL_TS80P
// TS80P pin map
#define KEY_B_Pin GPIO_PIN_0
#define KEY_B_GPIO_Port GPIOB
#define TMP36_INPUT_Pin GPIO_PIN_4
#define TMP36_INPUT_GPIO_Port GPIOA
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
#define TIP_TEMP_Pin GPIO_PIN_3
#define TIP_TEMP_GPIO_Port GPIOA
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
#define VIN_Pin GPIO_PIN_2
#define VIN_GPIO_Port GPIOA
#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
#define OLED_RESET_Pin GPIO_PIN_15
#define OLED_RESET_GPIO_Port GPIOA
#define KEY_A_Pin GPIO_PIN_1
#define KEY_A_GPIO_Port GPIOB
#define INT_Orientation_Pin GPIO_PIN_4
#define INT_Orientation_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_6
#define PWM_Out_GPIO_Port GPIOA
#define PWM_Out_CHANNEL TIM_CHANNEL_1
#define INT_Movement_Pin GPIO_PIN_5
#define INT_Movement_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_6
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
#define SCL2_Pin GPIO_PIN_5
#define SCL2_GPIO_Port GPIOA
#define SDA2_Pin GPIO_PIN_1
#define SDA2_GPIO_Port GPIOA
#define VIN_Pin GPIO_PIN_2
#define VIN_GPIO_Port GPIOA
#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
#define OLED_RESET_Pin GPIO_PIN_15
#define OLED_RESET_GPIO_Port GPIOA
#define KEY_A_Pin GPIO_PIN_1
#define KEY_A_GPIO_Port GPIOB
#define INT_Orientation_Pin GPIO_PIN_4
#define INT_Orientation_GPIO_Port GPIOB
#define PWM_Out_Pin GPIO_PIN_6
#define PWM_Out_GPIO_Port GPIOA
#define PWM_Out_CHANNEL TIM_CHANNEL_1
#define INT_Movement_Pin GPIO_PIN_5
#define INT_Movement_GPIO_Port GPIOB
#define SCL_Pin GPIO_PIN_6
#define SCL_GPIO_Port GPIOB
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
#define SCL2_Pin GPIO_PIN_5
#define SCL2_GPIO_Port GPIOA
#define SDA2_Pin GPIO_PIN_1
#define SDA2_GPIO_Port GPIOA
#define INT_PD_Pin GPIO_PIN_9
#define INT_PD_GPIO_Port GPIOA
#endif
#endif
#ifdef MODEL_TS80P
// TS80P pin map
#define INT_PD_Pin GPIO_PIN_9
#define INT_PD_GPIO_Port GPIOA
#endif
#endif /* BSP_MINIWARE_PINS_H_ */

View File

@@ -22,11 +22,7 @@ void power_check() {
}
bool getIsPoweredByDCIN() {
#ifdef MODEL_TS80
return false;
#endif
#ifdef MODEL_TS80P
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
return false;
#endif

View File

@@ -310,6 +310,9 @@ void HAL_ResumeTick(void);
uint32_t HAL_GetHalVersion(void);
uint32_t HAL_GetREVID(void);
uint32_t HAL_GetDEVID(void);
uint32_t HAL_GetUIDw0(void);
uint32_t HAL_GetUIDw1(void);
uint32_t HAL_GetUIDw2(void);
void HAL_DBGMCU_EnableDBGSleepMode(void);
void HAL_DBGMCU_DisableDBGSleepMode(void);
void HAL_DBGMCU_EnableDBGStopMode(void);

View File

@@ -513,6 +513,24 @@ void HAL_GetUID(uint32_t *UID) {
UID[2] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
}
/**
* @brief Returns first word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier
*/
uint32_t HAL_GetUIDw0(void) { return (READ_REG(*((uint32_t *)UID_BASE))); }
/**
* @brief Returns second word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier
*/
uint32_t HAL_GetUIDw1(void) { return (READ_REG(*((uint32_t *)(UID_BASE + 4U)))); }
/**
* @brief Returns third word of the unique device identifier (UID based on 96 bits)
* @retval Device identifier
*/
uint32_t HAL_GetUIDw2(void) { return (READ_REG(*((uint32_t *)(UID_BASE + 8U)))); }
/**
* @}
*/

View File

@@ -1,236 +1,208 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
* Define here your default pre settings for TS80(P) or TS100
*
*/
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
* Define here your default pre settings for TS80(P) or TS100
*
*/
//===========================================================================
//============================= Default Settings ============================
//===========================================================================
/**
* Default soldering temp is 320.0 C
* Temperature the iron sleeps at - default 150.0 C
*/
//===========================================================================
//============================= Default Settings ============================
//===========================================================================
/**
* Default soldering temp is 320.0 C
* Temperature the iron sleeps at - default 150.0 C
*/
#define SLEEP_TEMP 150 // Default sleep temperature
#define BOOST_TEMP 420 // Default boost temp.
#define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable
#define SLEEP_TEMP 150 // Default sleep temperature
#define BOOST_TEMP 420 // Default boost temp.
#define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable
/**
* Blink the temperature on the cooling screen when its > 50C
*/
#define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable
/**
* Blink the temperature on the cooling screen when its > 50C
*/
#define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable
/**
* How many seconds/minutes we wait until going to sleep/shutdown.
* Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds!
*/
#define SLEEP_TIME 5 // x10 Seconds
#define SHUTDOWN_TIME 10 // Minutes
/**
* How many seconds/minutes we wait until going to sleep/shutdown.
* Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds!
*/
#define SLEEP_TIME 5 // x10 Seconds
#define SHUTDOWN_TIME 10 // Minutes
/**
* Auto start off for safety.
* Pissible values are:
* 0 - none
* 1 - Soldering Temperature
* 2 - Sleep Temperature
* 3 - Sleep Off Temperature
*/
#define AUTO_START_MODE 0 // Default to none
/**
* Auto start off for safety.
* Pissible values are:
* 0 - none
* 1 - Soldering Temperature
* 2 - Sleep Temperature
* 3 - Sleep Off Temperature
*/
#define AUTO_START_MODE 0 // Default to none
/**
* Locking Mode
* When in soldering mode a long press on both keys toggle the lock of the buttons
* Possible values are:
* 0 - Desactivated
* 1 - Lock except boost
* 2 - Full lock
*/
#define LOCKING_MODE 0 // Default to desactivated for safety
/**
* Locking Mode
* When in soldering mode a long press on both keys toggle the lock of the buttons
* Possible values are:
* 0 - Desactivated
* 1 - Lock except boost
* 2 - Full lock
*/
#define LOCKING_MODE 0 // Default to desactivated for safety
/**
* OLED Orientation
*
*/
#define ORIENTATION_MODE 2 // 0: Right 1:Left 2:Automatic - Default Automatic
#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change
/**
* OLED Orientation
*
*/
#define ORIENTATION_MODE 2 // 0: Right 1:Left 2:Automatic - Default Automatic
#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change
/**
* Temp change settings
*/
#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1
#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10
#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value
#define TEMP_CHANGE_LONG_STEP_MAX 90 // Temp change long step MAX value
/**
* Temp change settings
*/
#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1
#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10
#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value
#define TEMP_CHANGE_LONG_STEP_MAX 90 // Temp change long step MAX value
/* Power pulse for keeping power banks awake*/
#define POWER_PULSE_INCREMENT 1
#define POWER_PULSE_MAX 100 // x10 max watts
#define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds
#define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds
/* Power pulse for keeping power banks awake*/
#define POWER_PULSE_INCREMENT 1
#define POWER_PULSE_MAX 100 // x10 max watts
#define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds
#define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds
#ifdef MODEL_TS100
#define POWER_PULSE_DEFAULT 0
#else
#define POWER_PULSE_DEFAULT 5
#endif
#define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s
#define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms
#ifdef MODEL_TS100
#define POWER_PULSE_DEFAULT 0
#else
#define POWER_PULSE_DEFAULT 5
#endif
#define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s
#define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms
/**
* OLED Orientation Sensitivity on Automatic mode!
* Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive>
*/
#define SENSITIVITY 7 // Default 7
/**
* OLED Orientation Sensitivity on Automatic mode!
* Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive>
*/
#define SENSITIVITY 7 // Default 7
/**
* Detailed soldering screen
* Detailed idle screen (off for first time users)
*/
#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0
#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0
/**
* Detailed soldering screen
* Detailed idle screen (off for first time users)
*/
#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0
#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0
#define THERMAL_RUNAWAY_TIME_SEC 20
#define THERMAL_RUNAWAY_TEMP_C 10
#define THERMAL_RUNAWAY_TIME_SEC 20
#define THERMAL_RUNAWAY_TEMP_C 10
#define CUT_OUT_SETTING 0 // default to no cut-off voltage
#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33))
#define TEMPERATURE_INF 0 // default to 0
#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow
#define ANIMATION_LOOP 1 // 0: off 1: on
#define ANIMATION_SPEED settingOffSpeed_t::MEDIUM
#define CUT_OUT_SETTING 0 // default to no cut-off voltage
#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33))
#define TEMPERATURE_INF 0 // default to 0
#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow
#define ANIMATION_LOOP 1 // 0: off 1: on
#define ANIMATION_SPEED settingOffSpeed_t::MEDIUM
#define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1
#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2
#define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1
#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2
#define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100))
#define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100))
#define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6
#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3
#define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6
#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3
#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80))
#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80))
// Deriving the Voltage div:
// Vin_max = (3.3*(r1+r2))/(r2)
// vdiv = (32768*4)/(vin_max*10)
// Deriving the Voltage div:
// Vin_max = (3.3*(r1+r2))/(r2)
// vdiv = (32768*4)/(vin_max*10)
#if defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) > 1
#error "Multiple models defined!"
#elif defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) == 0
#error "No model defined!"
#if defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) > 1
#error "Multiple models defined!"
#elif defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) == 0
#error "No model defined!"
#endif
// Miniware is swapping IMU's around a bit now, so we turn them all on
#define ACCEL_MMA
#define ACCEL_LIS
#define ACCEL_SC7
#define ACCEL_MSA
#define ACCEL_BMA
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#ifdef MODEL_TS100
#define VOLTAGE_DIV 467 // 467 - Default divider from schematic
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
#define POWER_LIMIT 0 // 0 watts default limit
#define MAX_POWER_LIMIT 70
#define POWER_LIMIT_STEPS 5
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100
#define TEMP_uV_LOOKUP_HAKKO
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define HARDWARE_MAX_WATTAGE_X10 750
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips
#define POW_DC
#define POW_PD 0
#define TEMP_TMP36
#endif
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
#define MAX_POWER_LIMIT 40
#define POWER_LIMIT_STEPS 2
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80
#define TEMP_uV_LOOKUP_TS80
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define TIP_THERMAL_MASS 40
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
#define LIS_ORI_FLIP
#define OLED_FLIP
#endif
#ifdef MODEL_TS80
#define VOLTAGE_DIV 780 // Default divider from schematic
#define CALIBRATION_OFFSET 900 // the adc offset in uV
#define PID_POWER_LIMIT 24 // Sets the max pwm power limit
#define POWER_LIMIT 24 // 24 watts default power limit
#define HARDWARE_MAX_WATTAGE_X10 180
#define POW_QC
#define POW_PD 0
#define TEMP_TMP36
#endif
#ifdef MODEL_TS80P
#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors
#define CALIBRATION_OFFSET 1500 // the adc offset in uV
#define PID_POWER_LIMIT 35 // Sets the max pwm power limit
#define POWER_LIMIT 30 // 30 watts default power limit
#define HARDWARE_MAX_WATTAGE_X10 300
#define POW_PD 1
#define POW_QC 1
#define TEMP_NTC
#define I2C_SOFT
#define SC7_ORI_FLIP
#endif
#endif
// Miniware is swapping IMU's around a bit now, so we turn them all on
#define ACCEL_MMA
#define ACCEL_LIS
#define ACCEL_SC7
#define ACCEL_MSA
#define ACCEL_BMA
#ifdef MODEL_TS100
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 467 // 467 - Default divider from schematic
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
#define POWER_LIMIT 0 // 0 watts default limit
#define MAX_POWER_LIMIT 70 //
#define POWER_LIMIT_STEPS 5 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 //
#define TEMP_uV_LOOKUP_HAKKO //
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define POW_DC
#define POW_PD 0
#define TEMP_TMP36
#endif
#ifdef MODEL_TS80
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 780 // Default divider from schematic
#define PID_POWER_LIMIT 24 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 900 // the adc offset in uV
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define POWER_LIMIT 24 // 24 watts default power limit
#define MAX_POWER_LIMIT 40 //
#define POWER_LIMIT_STEPS 2 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 //
#define TEMP_uV_LOOKUP_TS80 //
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define POW_QC
#define POW_PD 0
#define TEMP_TMP36
#define LIS_ORI_FLIP
#define OLED_FLIP
#endif
#ifdef MODEL_TS80P
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors
#define PID_POWER_LIMIT 35 // Sets the max pwm power limit
#define CALIBRATION_OFFSET 1500 // the adc offset in uV
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
#define POWER_LIMIT 30 // 30 watts default power limit
#define MAX_POWER_LIMIT 40 //
#define POWER_LIMIT_STEPS 2 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 //
#define TEMP_uV_LOOKUP_TS80 //
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
#define POW_PD 1
#define POW_QC 1
#define TEMP_NTC
#define I2C_SOFT
#define LIS_ORI_FLIP
#define SC7_ORI_FLIP
#define OLED_FLIP
#endif
#ifdef MODEL_TS100
#define HARDWARE_MAX_WATTAGE_X10 750
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips
#endif
#ifdef MODEL_TS80
#define HARDWARE_MAX_WATTAGE_X10 180
#define TIP_THERMAL_MASS 40
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
#endif
#ifdef MODEL_TS80P
#define HARDWARE_MAX_WATTAGE_X10 300
#define TIP_THERMAL_MASS 40
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
#endif
#endif
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))

View File

@@ -0,0 +1,344 @@
/**
******************************************************************************
* @file startup_stm32.s
* @author Ac6
* @version V1.0.0
* @date 12-June-2014
******************************************************************************
*/
.syntax unified
.cpu cortex-m3
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
.equ BootRAM, 0xF1E0F85F
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4
LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call static constructors */
bl __libc_init_array
/* Call the application's entry point.*/
bl main
LoopForever:
b LoopForever
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
*
* @param None
* @retval : None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The minimal vector table for a Cortex-M. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
.word WWDG_IRQHandler
.word PVD_IRQHandler
.word TAMPER_IRQHandler
.word RTC_IRQHandler
.word FLASH_IRQHandler
.word RCC_IRQHandler
.word EXTI0_IRQHandler
.word EXTI1_IRQHandler
.word EXTI2_IRQHandler
.word EXTI3_IRQHandler
.word EXTI4_IRQHandler
.word DMA1_Channel1_IRQHandler
.word DMA1_Channel2_IRQHandler
.word DMA1_Channel3_IRQHandler
.word DMA1_Channel4_IRQHandler
.word DMA1_Channel5_IRQHandler
.word DMA1_Channel6_IRQHandler
.word DMA1_Channel7_IRQHandler
.word ADC1_2_IRQHandler
.word USB_HP_CAN1_TX_IRQHandler
.word USB_LP_CAN1_RX0_IRQHandler
.word CAN1_RX1_IRQHandler
.word CAN1_SCE_IRQHandler
.word EXTI9_5_IRQHandler
.word TIM1_BRK_IRQHandler
.word TIM1_UP_IRQHandler
.word TIM1_TRG_COM_IRQHandler
.word TIM1_CC_IRQHandler
.word TIM2_IRQHandler
.word TIM3_IRQHandler
.word TIM4_IRQHandler
.word I2C1_EV_IRQHandler
.word I2C1_ER_IRQHandler
.word I2C2_EV_IRQHandler
.word I2C2_ER_IRQHandler
.word SPI1_IRQHandler
.word SPI2_IRQHandler
.word USART1_IRQHandler
.word USART2_IRQHandler
.word USART3_IRQHandler
.word EXTI15_10_IRQHandler
.word RTC_Alarm_IRQHandler
.word USBWakeUp_IRQHandler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word BootRAM /* @0x108. This is for boot in RAM mode for
STM32F10x Medium Density devices. */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
.weak PVD_IRQHandler
.thumb_set PVD_IRQHandler,Default_Handler
.weak TAMPER_IRQHandler
.thumb_set TAMPER_IRQHandler,Default_Handler
.weak RTC_IRQHandler
.thumb_set RTC_IRQHandler,Default_Handler
.weak FLASH_IRQHandler
.thumb_set FLASH_IRQHandler,Default_Handler
.weak RCC_IRQHandler
.thumb_set RCC_IRQHandler,Default_Handler
.weak EXTI0_IRQHandler
.thumb_set EXTI0_IRQHandler,Default_Handler
.weak EXTI1_IRQHandler
.thumb_set EXTI1_IRQHandler,Default_Handler
.weak EXTI2_IRQHandler
.thumb_set EXTI2_IRQHandler,Default_Handler
.weak EXTI3_IRQHandler
.thumb_set EXTI3_IRQHandler,Default_Handler
.weak EXTI4_IRQHandler
.thumb_set EXTI4_IRQHandler,Default_Handler
.weak DMA1_Channel1_IRQHandler
.thumb_set DMA1_Channel1_IRQHandler,Default_Handler
.weak DMA1_Channel2_IRQHandler
.thumb_set DMA1_Channel2_IRQHandler,Default_Handler
.weak DMA1_Channel3_IRQHandler
.thumb_set DMA1_Channel3_IRQHandler,Default_Handler
.weak DMA1_Channel4_IRQHandler
.thumb_set DMA1_Channel4_IRQHandler,Default_Handler
.weak DMA1_Channel5_IRQHandler
.thumb_set DMA1_Channel5_IRQHandler,Default_Handler
.weak DMA1_Channel6_IRQHandler
.thumb_set DMA1_Channel6_IRQHandler,Default_Handler
.weak DMA1_Channel7_IRQHandler
.thumb_set DMA1_Channel7_IRQHandler,Default_Handler
.weak ADC1_2_IRQHandler
.thumb_set ADC1_2_IRQHandler,Default_Handler
.weak USB_HP_CAN1_TX_IRQHandler
.thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
.weak USB_LP_CAN1_RX0_IRQHandler
.thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
.weak CAN1_RX1_IRQHandler
.thumb_set CAN1_RX1_IRQHandler,Default_Handler
.weak CAN1_SCE_IRQHandler
.thumb_set CAN1_SCE_IRQHandler,Default_Handler
.weak EXTI9_5_IRQHandler
.thumb_set EXTI9_5_IRQHandler,Default_Handler
.weak TIM1_BRK_IRQHandler
.thumb_set TIM1_BRK_IRQHandler,Default_Handler
.weak TIM1_UP_IRQHandler
.thumb_set TIM1_UP_IRQHandler,Default_Handler
.weak TIM1_TRG_COM_IRQHandler
.thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
.weak TIM1_CC_IRQHandler
.thumb_set TIM1_CC_IRQHandler,Default_Handler
.weak TIM2_IRQHandler
.thumb_set TIM2_IRQHandler,Default_Handler
.weak TIM3_IRQHandler
.thumb_set TIM3_IRQHandler,Default_Handler
.weak TIM4_IRQHandler
.thumb_set TIM4_IRQHandler,Default_Handler
.weak I2C1_EV_IRQHandler
.thumb_set I2C1_EV_IRQHandler,Default_Handler
.weak I2C1_ER_IRQHandler
.thumb_set I2C1_ER_IRQHandler,Default_Handler
.weak I2C2_EV_IRQHandler
.thumb_set I2C2_EV_IRQHandler,Default_Handler
.weak I2C2_ER_IRQHandler
.thumb_set I2C2_ER_IRQHandler,Default_Handler
.weak SPI1_IRQHandler
.thumb_set SPI1_IRQHandler,Default_Handler
.weak SPI2_IRQHandler
.thumb_set SPI2_IRQHandler,Default_Handler
.weak USART1_IRQHandler
.thumb_set USART1_IRQHandler,Default_Handler
.weak USART2_IRQHandler
.thumb_set USART2_IRQHandler,Default_Handler
.weak USART3_IRQHandler
.thumb_set USART3_IRQHandler,Default_Handler
.weak EXTI15_10_IRQHandler
.thumb_set EXTI15_10_IRQHandler,Default_Handler
.weak RTC_Alarm_IRQHandler
.thumb_set RTC_Alarm_IRQHandler,Default_Handler
.weak USBWakeUp_IRQHandler
.thumb_set USBWakeUp_IRQHandler,Default_Handler
/************************ (C) COPYRIGHT Ac6 *****END OF FILE****/

View File

@@ -90,3 +90,6 @@ bool isTipDisconnected() {
}
void setStatusLED(const enum StatusLED state) {}
uint8_t preStartChecks() { return 0; }
uint64_t getDeviceID() { return dbg_id_get(); }

View File

@@ -0,0 +1,63 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NMSIS/Core/Include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/)
set(sources
# Vendor Code
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC/portasm.S
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC/port.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/gd32vf103_soc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/system_gd32vf103.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_adc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_bkp.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_crc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_dac.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_dbg.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_dma.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_eclic.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_exmc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_exti.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_fmc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_fwdgt.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_gpio.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_i2c.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_pmu.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_rcu.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_rtc.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_spi.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_timer.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_usart.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/gd32vf103_wwdgt.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Drivers/n200_func.c
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/GCC/intexc_gd32vf103.S
${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/GCC/startup_gd32vf103.S
BSP.cpp
Debug.cpp
I2C_Wrapper.cpp
postRTOS.cpp
preRTOS.cpp
flash.c
fusb_user.cpp
ThermoModel.cpp
IRQ.cpp
Setup.cpp
Power.cpp
QC_GPIO.cpp
)
add_library(BSPImplementation ${sources})
target_include_directories(BSPImplementation PUBLIC . ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NMSIS/Core/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/OS/FreeRTOS/Source/portable/GCC ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Include ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/ ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/SoC/gd32vf103/Common/Source/Stubs/)
target_compile_definitions (BSPImplementation PUBLIC -DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP -DUSE_RTOS_SYSTICK -DVECT_TAB_OFFSET=0U)
target_link_libraries(BSPImplementation PRIVATE brieflz BSP threads drivers mainSource)
target_link_libraries(${elf_file} PUBLIC -Wl,--defsym=__FLASH_SIZE__=128k -Wl,--defsym=__BOOTLDR_SIZE__=0)
set(DEVICE_DFU_ADDRESS 0x08000000)
set(DEVICE_DFU_VID_PID 0x28E9:0x0189)

View File

@@ -2,10 +2,12 @@
#define FREERTOS_CONFIG_H
#include "nuclei_sdk_soc.h"
#include <stdint.h>
#define configISR_STACK_SIZE_WORDS 1024
#define configCLINT_BASE_ADDRESS 0
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configUSE_TICKLESS_IDLE 0
#define configCPU_CLOCK_HZ ((uint32_t)SystemCoreClock)
#define configCPU_CLOCK_HZ (108000000U / 4)
#define configRTC_CLOCK_HZ ((uint32_t)32768)
#define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES (4)

View File

@@ -8,6 +8,7 @@
#include "IRQ.h"
#include "Pins.h"
#include "configuration.h"
#include "main.hpp"
volatile uint8_t i2c_read_process = 0;
volatile uint8_t i2c_write_process = 0;
volatile uint8_t i2c_slave_address = 0;

View File

@@ -0,0 +1,19 @@
#ifndef __FREERTOS_RISC_V_EXTENSIONS_H__
#define __FREERTOS_RISC_V_EXTENSIONS_H__
#define portasmHAS_CLINT 0
#define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */
.macro portasmSAVE_ADDITIONAL_REGISTERS
/* No additional registers to save, so this macro does nothing. */
.endm
/* Restore the additional registers found on the Pulpino. */
.macro portasmRESTORE_ADDITIONAL_REGISTERS
/* No additional registers to restore, so this macro does nothing. */
.endm
/* hkim temporary workaround */
#define portasmMCAUSE_MASK 0xfff
#define portasmHANDLE_INTERRUPT irq_entry
#endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */

View File

@@ -26,55 +26,18 @@
*/
/*-----------------------------------------------------------
* Implementation of functions defined in portable.h for the Nuclei N/NX Processor port.
* Implementation of functions defined in portable.h for the RISC-V RV32 port.
*----------------------------------------------------------*/
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "portmacro.h"
#include "task.h"
#include <stdio.h>
//#define ENABLE_KERNEL_DEBUG
#ifdef ENABLE_KERNEL_DEBUG
#define FREERTOS_PORT_DEBUG(...) printf(__VA_ARGS__)
#else
#define FREERTOS_PORT_DEBUG(...)
#ifndef configCLINT_BASE_ADDRESS
#warning configCLINT_BASE_ADDRESS must be defined in FreeRTOSConfig.h. If the target chip includes a Core Local Interrupter (CLINT) then set configCLINT_BASE_ADDRESS to the CLINT base address. Otherwise set configCLINT_BASE_ADDRESS to 0.
#endif
#ifndef configSYSTICK_CLOCK_HZ
#define configSYSTICK_CLOCK_HZ SOC_TIMER_FREQ
#endif
#ifndef configKERNEL_INTERRUPT_PRIORITY
#define configKERNEL_INTERRUPT_PRIORITY 0
#endif
#ifndef configMAX_SYSCALL_INTERRUPT_PRIORITY
// See function prvCheckMaxSysCallPrio and prvCalcMaxSysCallMTH
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 255
#endif
/* Constants required to check the validity of an interrupt priority. */
#define portFIRST_USER_INTERRUPT_NUMBER (18)
#define SYSTICK_TICK_CONST (configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ)
/* Masks off all bits but the ECLIC MTH bits in the MTH register. */
#define portMTH_MASK (0xFFUL)
/* Constants required to set up the initial stack. */
#define portINITIAL_MSTATUS (MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
#define portINITIAL_EXC_RETURN (0xfffffffd)
/* The systick is a 64-bit counter. */
#define portMAX_BIT_NUMBER (SysTimer_MTIMER_Msk)
/* A fiddle factor to estimate the number of SysTick counts that would have
occurred while the SysTick counter is stopped during tickless idle
calculations. */
#define portMISSED_COUNTS_FACTOR (45UL)
/* Let the user override the pre-loading of the initial LR with the address of
prvTaskExitError() in case it messes up unwinding of the stack in the
debugger. */
@@ -84,574 +47,145 @@ debugger. */
#define portTASK_RETURN_ADDRESS prvTaskExitError
#endif
/* The stack used by interrupt service routines. Set configISR_STACK_SIZE_WORDS
to use a statically allocated array as the interrupt stack. Alternative leave
configISR_STACK_SIZE_WORDS undefined and update the linker script so that a
linker variable names __freertos_irq_stack_top has the same value as the top
of the stack used by main. Using the linker script method will repurpose the
stack that was used by main before the scheduler was started for use as the
interrupt stack after the scheduler has started. */
#ifdef configISR_STACK_SIZE_WORDS
static __attribute__((aligned(16))) StackType_t xISRStack[configISR_STACK_SIZE_WORDS] = {0};
const StackType_t xISRStackTop = (StackType_t) & (xISRStack[(configISR_STACK_SIZE_WORDS & ~portBYTE_ALIGNMENT_MASK) - 1]);
#else
extern const uint32_t __freertos_irq_stack_top[];
const StackType_t xISRStackTop = (StackType_t)__freertos_irq_stack_top;
#endif
/*
* Setup the timer to generate the tick interrupts. The implementation in this
* file is weak to allow application writers to change the timer used to
* generate the tick interrupt.
*/
void vPortSetupTimerInterrupt(void);
/*
* Exception handlers.
*/
void xPortSysTickHandler(void);
/*
* Start first task is a separate function so it can be tested in isolation.
*/
extern void prvPortStartFirstTask(void) __attribute__((naked));
/*
* Used to catch tasks that attempt to return from their implementing function.
*/
static void prvTaskExitError(void);
#define xPortSysTickHandler eclic_mtip_handler
void vPortSetupTimerInterrupt(void) __attribute__((weak));
/*-----------------------------------------------------------*/
/* Each task maintains its own interrupt status in the critical nesting
variable. */
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;
/* Used to program the machine timer compare register. */
uint64_t ullNextTime = 0ULL;
const uint64_t *pullNextTime = &ullNextTime;
const size_t uxTimerIncrementsForOneTick = (size_t)(configCPU_CLOCK_HZ / configTICK_RATE_HZ); /* Assumes increment won't go over 32-bits. */
volatile uint64_t *const pullMachineTimerCompareRegister = (volatile uint64_t *const)(configCLINT_BASE_ADDRESS + 0x4000);
/*
* Record the real MTH calculated by the configMAX_SYSCALL_INTERRUPT_PRIORITY
* The configMAX_SYSCALL_INTERRUPT_PRIORITY is not the left-aligned level value,
* See equations below:
* Level Bits number: lvlbits = min(nlbits, CLICINTCTLBITS)
* Left align Bits number: lfabits = 8-lvlbits
* 0 < configMAX_SYSCALL_INTERRUPT_PRIORITY <= (2^lvlbits-1)
* uxMaxSysCallMTH = (configMAX_SYSCALL_INTERRUPT_PRIORITY << lfabits) | ((2^lfabits)-1)
* If nlbits = 3, CLICINTCTLBITS=3, then lvlbits = 3, lfabits = 5
* Set configMAX_SYSCALL_INTERRUPT_PRIORITY to 6
* Then uxMaxSysCallMTH = (6<<5) | (2^5 - 1) = 223
*
* See function prvCheckMaxSysCallPrio and prvCalcMaxSysCallMTH
*/
uint8_t uxMaxSysCallMTH = 255;
/* Set configCHECK_FOR_STACK_OVERFLOW to 3 to add ISR stack checking to task
stack checking. A problem in the ISR stack will trigger an assert, not call the
stack overflow hook function (because the stack overflow hook is specific to a
task stack, not the ISR stack). */
#if (configCHECK_FOR_STACK_OVERFLOW > 2)
#warning This path not tested, or even compiled yet.
/* Don't use 0xa5 as the stack fill bytes as that is used by the kernerl for
the task stacks, and so will legitimately appear in many positions within
the ISR stack. */
#define portISR_STACK_FILL_BYTE 0xee
/*
* The number of SysTick increments that make up one tick period.
*/
#if (configUSE_TICKLESS_IDLE == 1)
static TickType_t ulTimerCountsForOneTick = 0;
#endif /* configUSE_TICKLESS_IDLE */
static const uint8_t ucExpectedStackBytes[]
= {portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE,
portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE,
portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE, portISR_STACK_FILL_BYTE};
/*
* The maximum number of tick periods that can be suppressed is limited by the
* 24 bit resolution of the SysTick timer.
*/
#if (configUSE_TICKLESS_IDLE == 1)
static TickType_t xMaximumPossibleSuppressedTicks = 0;
#endif /* configUSE_TICKLESS_IDLE */
/*
* Compensate for the CPU cycles that pass while the SysTick is stopped (low
* power functionality only.
*/
#if (configUSE_TICKLESS_IDLE == 1)
static TickType_t ulStoppedTimerCompensation = 0;
#endif /* configUSE_TICKLESS_IDLE */
/*
* Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure
* FreeRTOS API functions are not called from interrupts that have been assigned
* a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY.
*/
#if (configASSERT_DEFINED == 1)
static uint8_t ucMaxSysCallPriority = 0;
#endif /* configASSERT_DEFINED */
/*-----------------------------------------------------------*/
/*
* See header file for description.
* As per the standard RISC-V ABI pxTopcOfStack is passed in in a0, pxCode in
* a1, and pvParameters in a2. The new top of stack is passed out in a0.
*
* RISC-V maps registers to ABI names as follows (X1 to X31 integer registers
* for the 'I' profile, X1 to X15 for the 'E' profile, currently I assumed).
*
* Register ABI Name Description Saver
* x0 zero Hard-wired zero -
* x1 ra Return address Caller
* x2 sp Stack pointer Callee
* x3 gp Global pointer -
* x4 tp Thread pointer -
* x5-7 t0-2 Temporaries Caller
* x8 s0/fp Saved register/Frame pointer Callee
* x9 s1 Saved register Callee
* x10-11 a0-1 Function Arguments/return values Caller
* x12-17 a2-7 Function arguments Caller
* x18-27 s2-11 Saved registers Callee
* x28-31 t3-6 Temporaries Caller
*
* The RISC-V context is saved RTOS tasks in the following stack frame,
* where the global and thread pointers are currently assumed to be constant so
* are not saved:
*
* mstatus
* #ifndef __riscv_32e
* x31
* x30
* x29
* x28
* x27
* x26
* x25
* x24
* x23
* x22
* x21
* x20
* x19
* x18
* x17
* x16
* #endif
* x15
* x14
* x13
* x12
* x11
* pvParameters
* x9
* x8
* x7
* x6
* x5
* portTASK_RETURN_ADDRESS
* pxCode
*/
StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) {
/* Simulate the stack frame as it would be created by a context switch
interrupt. */
/* Offset added to account for the way the MCU uses the stack on entry/exit
of interrupts, and to ensure alignment. */
pxTopOfStack--;
*pxTopOfStack = portINITIAL_MSTATUS; /* MSTATUS */
/* Save code space by skipping register initialisation. */
#ifndef __riscv_32e
pxTopOfStack -= 22; /* X11 - X31. */
#define portCHECK_ISR_STACK() configASSERT((memcmp((void *)xISRStack, (void *)ucExpectedStackBytes, sizeof(ucExpectedStackBytes)) == 0))
#else
pxTopOfStack -= 6; /* X11 - X15. */
#endif
*pxTopOfStack = (StackType_t)pvParameters; /* X10/A0 */
pxTopOfStack -= 6; /* X5 - X9 */
*pxTopOfStack = (StackType_t)portTASK_RETURN_ADDRESS; /* RA, X1 */
/* Define the function away. */
#define portCHECK_ISR_STACK()
#endif /* configCHECK_FOR_STACK_OVERFLOW > 2 */
pxTopOfStack--;
*pxTopOfStack = ((StackType_t)pxCode); /* PC */
return pxTopOfStack;
}
/*-----------------------------------------------------------*/
static void prvTaskExitError(void) {
volatile uint32_t ulDummy = 0;
#if (configCLINT_BASE_ADDRESS != 0)
/* A function that implements a task must not exit or attempt to return to
its caller as there is nothing to return to. If a task wants to exit it
should instead call vTaskDelete( NULL ).
void vPortSetupTimerInterrupt(void) {
uint32_t ulCurrentTimeHigh, ulCurrentTimeLow;
volatile uint32_t *const pulTimeHigh = (volatile uint32_t *const)(configCLINT_BASE_ADDRESS + 0xBFFC);
volatile uint32_t *const pulTimeLow = (volatile uint32_t *const)(configCLINT_BASE_ADDRESS + 0xBFF8);
Artificially force an assert() to be triggered if configASSERT() is
defined, then stop here so application writers can catch the error. */
configASSERT(uxCriticalNesting == ~0UL);
portDISABLE_INTERRUPTS();
while (ulDummy == 0) {
/* This file calls prvTaskExitError() after the scheduler has been
started to remove a compiler warning about the function being defined
but never called. ulDummy is used purely to quieten other warnings
about code appearing after this function is called - making ulDummy
volatile makes the compiler think the function could return and
therefore not output an 'unreachable code' warning for code that appears
after it. */
/* Sleep and wait for interrupt */
__WFI();
}
do {
ulCurrentTimeHigh = *pulTimeHigh;
ulCurrentTimeLow = *pulTimeLow;
} while (ulCurrentTimeHigh != *pulTimeHigh);
ullNextTime = (uint64_t)ulCurrentTimeHigh;
ullNextTime <<= 32ULL;
ullNextTime |= (uint64_t)ulCurrentTimeLow;
ullNextTime += (uint64_t)uxTimerIncrementsForOneTick;
*pullMachineTimerCompareRegister = ullNextTime;
/* Prepare the time to use after the next tick interrupt. */
ullNextTime += (uint64_t)uxTimerIncrementsForOneTick;
}
#endif /* ( configCLINT_BASE_ADDRESS != 0 ) */
/*-----------------------------------------------------------*/
static uint8_t prvCheckMaxSysCallPrio(uint8_t max_syscall_prio) {
uint8_t nlbits = __ECLIC_GetCfgNlbits();
uint8_t intctlbits = __ECLIC_INTCTLBITS;
uint8_t lvlbits, temp;
if (nlbits <= intctlbits) {
lvlbits = nlbits;
} else {
lvlbits = intctlbits;
}
temp = ((1 << lvlbits) - 1);
if (max_syscall_prio > temp) {
max_syscall_prio = temp;
}
return max_syscall_prio;
}
static uint8_t prvCalcMaxSysCallMTH(uint8_t max_syscall_prio) {
uint8_t nlbits = __ECLIC_GetCfgNlbits();
uint8_t intctlbits = __ECLIC_INTCTLBITS;
uint8_t lvlbits, lfabits;
uint8_t maxsyscallmth = 0;
uint8_t temp;
if (nlbits <= intctlbits) {
lvlbits = nlbits;
} else {
lvlbits = intctlbits;
}
lfabits = 8 - lvlbits;
temp = ((1 << lvlbits) - 1);
if (max_syscall_prio > temp) {
max_syscall_prio = temp;
}
maxsyscallmth = (max_syscall_prio << lfabits) | ((1 << lfabits) - 1);
return maxsyscallmth;
}
/*
* See header file for description.
*/
BaseType_t xPortStartScheduler(void) {
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. */
configASSERT(configMAX_SYSCALL_INTERRUPT_PRIORITY);
/* Get the real MTH should be set to ECLIC MTH register */
uxMaxSysCallMTH = prvCalcMaxSysCallMTH(configMAX_SYSCALL_INTERRUPT_PRIORITY);
FREERTOS_PORT_DEBUG("Max SysCall MTH is set to 0x%x\n", uxMaxSysCallMTH);
extern void xPortStartFirstTask(void);
#if (configASSERT_DEFINED == 1)
{
/* Use the same mask on the maximum system call priority. */
ucMaxSysCallPriority = prvCheckMaxSysCallPrio(configMAX_SYSCALL_INTERRUPT_PRIORITY);
FREERTOS_PORT_DEBUG("Max SysCall Priority is set to %d\n", ucMaxSysCallPriority);
}
#endif /* conifgASSERT_DEFINED */
volatile uint32_t mtvec = 0;
__disable_irq();
/* Start the timer that generates the tick ISR. Interrupts are disabled
here already. */
/* Check the least significant two bits of mtvec are 00 - indicating
single vector mode. */
__asm volatile("csrr %0, mtvec" : "=r"(mtvec));
configASSERT((mtvec & 0x03UL) == 0);
/* Check alignment of the interrupt stack - which is the same as the
stack that was being used by main() prior to the scheduler being
started. */
configASSERT((xISRStackTop & portBYTE_ALIGNMENT_MASK) == 0);
}
#endif /* configASSERT_DEFINED */
/* If there is a CLINT then it is ok to use the default implementation
in this file, otherwise vPortSetupTimerInterrupt() must be implemented to
configure whichever clock is to be used to generate the tick interrupt. */
vPortSetupTimerInterrupt();
/* Initialise the critical nesting count ready for the first task. */
uxCriticalNesting = 0;
#if (configCLINT_BASE_ADDRESS != 0)
{
/* Enable mtime and external interrupts. 1<<7 for timer interrupt, 1<<11
for external interrupt. _RB_ What happens here when mtime is not present as
with pulpino? */
__asm volatile("csrs mie, %0" ::"r"(0x880));
}
#else
{
/* Enable external interrupts. */
__asm volatile("csrs mie, %0" ::"r"(0x800));
}
#endif /* configCLINT_BASE_ADDRESS */
/* Start the first task. */
prvPortStartFirstTask();
xPortStartFirstTask();
/* Should never get here as the tasks will now be executing! Call the task
exit error function to prevent compiler warnings about a static function
not being called in the case that the application writer overrides this
functionality by defining configTASK_RETURN_ADDRESS. Call
vTaskSwitchContext() so link time optimisation does not remove the
symbol. */
vTaskSwitchContext();
prvTaskExitError();
/* Should not get here! */
return 0;
/* Should not get here as after calling xPortStartFirstTask() only tasks
should be executing. */
return pdFAIL;
}
/*-----------------------------------------------------------*/
void vPortEndScheduler(void) {
/* Not implemented in ports where there is nothing to return to.
Artificially force an assert. */
configASSERT(uxCriticalNesting == 1000UL);
}
/*-----------------------------------------------------------*/
void vPortEnterCritical(void) {
portDISABLE_INTERRUPTS();
uxCriticalNesting++;
/* This is not the interrupt safe version of the enter critical function so
assert() if it is being called from an interrupt context. Only API
functions that end in "FromISR" can be used in an interrupt. Only assert if
the critical nesting count is 1 to protect against recursive calls if the
assert function also uses a critical section. */
if (uxCriticalNesting == 1) {
configASSERT((__ECLIC_GetMth() & portMTH_MASK) == uxMaxSysCallMTH);
}
}
/*-----------------------------------------------------------*/
void vPortExitCritical(void) {
configASSERT(uxCriticalNesting);
uxCriticalNesting--;
if (uxCriticalNesting == 0) {
portENABLE_INTERRUPTS();
}
}
/*-----------------------------------------------------------*/
void vPortAssert(int32_t x) {
TaskHandle_t th;
if ((x) == 0) {
taskDISABLE_INTERRUPTS();
#if (INCLUDE_xTaskGetCurrentTaskHandle == 1)
th = xTaskGetCurrentTaskHandle();
if (th) {
printf("Assert in task %s\n", pcTaskGetName(th));
}
#endif
while (1) {
/* Sleep and wait for interrupt */
__WFI();
};
}
}
/*-----------------------------------------------------------*/
void xPortTaskSwitch(void) {
portDISABLE_INTERRUPTS();
/* Clear Software IRQ, A MUST */
SysTimer_ClearSWIRQ();
vTaskSwitchContext();
portENABLE_INTERRUPTS();
}
/*-----------------------------------------------------------*/
void xPortSysTickHandler(void) {
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
executes all interrupts must be unmasked. There is therefore no need to
save and then restore the interrupt mask value as its value is already
known. */
portDISABLE_INTERRUPTS();
{
SysTick_Reload(SYSTICK_TICK_CONST);
/* Increment the RTOS tick. */
if (xTaskIncrementTick() != pdFALSE) {
/* A context switch is required. Context switching is performed in
the SWI interrupt. Pend the SWI interrupt. */
portYIELD();
}
}
portENABLE_INTERRUPTS();
}
/*-----------------------------------------------------------*/
#if (configUSE_TICKLESS_IDLE == 1)
__attribute__((weak)) void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime) {
uint32_t ulReloadValue, ulCompleteTickPeriods, ulCompletedSysTickDecrements;
volatile TickType_t xModifiableIdleTime, xTickCountBeforeSleep, XLastLoadValue;
FREERTOS_PORT_DEBUG("Enter TickLess %d\n", (uint32_t)xExpectedIdleTime);
/* Make sure the SysTick reload value does not overflow the counter. */
if (xExpectedIdleTime > xMaximumPossibleSuppressedTicks) {
xExpectedIdleTime = xMaximumPossibleSuppressedTicks;
}
/* Stop the SysTick momentarily. The time the SysTick is stopped for
is accounted for as best it can be, but using the tickless mode will
inevitably result in some tiny drift of the time maintained by the
kernel with respect to calendar time. */
SysTimer_Stop();
/* Calculate the reload value required to wait xExpectedIdleTime
tick periods. -1 is used because this code will execute part way
through one of the tick periods. */
ulReloadValue = (ulTimerCountsForOneTick * (xExpectedIdleTime - 1UL));
if (ulReloadValue > ulStoppedTimerCompensation) {
ulReloadValue -= ulStoppedTimerCompensation;
}
/* Enter a critical section but don't use the taskENTER_CRITICAL()
method as that will mask interrupts that should exit sleep mode. */
__disable_irq();
/* If a context switch is pending or a task is waiting for the scheduler
to be unsuspended then abandon the low power entry. */
if (eTaskConfirmSleepModeStatus() == eAbortSleep) {
/* Restart from whatever is left in the count register to complete
this tick period. */
/* Restart SysTick. */
SysTimer_Start();
/* Reset the reload register to the value required for normal tick
periods. */
SysTick_Reload(ulTimerCountsForOneTick);
/* Re-enable interrupts - see comments above the cpsid instruction()
above. */
__enable_irq();
} else {
xTickCountBeforeSleep = xTaskGetTickCount();
/* Set the new reload value. */
SysTick_Reload(ulReloadValue);
/* Get System timer load value before sleep */
XLastLoadValue = SysTimer_GetLoadValue();
/* Restart SysTick. */
SysTimer_Start();
ECLIC_EnableIRQ(SysTimer_IRQn);
__RWMB();
/* Sleep until something happens. configPRE_SLEEP_PROCESSING() can
set its parameter to 0 to indicate that its implementation contains
its own wait for interrupt or wait for event instruction, and so wfi
should not be executed again. However, the original expected idle
time variable must remain unmodified, so a copy is taken. */
xModifiableIdleTime = xExpectedIdleTime;
configPRE_SLEEP_PROCESSING(xModifiableIdleTime);
if (xModifiableIdleTime > 0) {
__WFI();
}
configPOST_SLEEP_PROCESSING(xExpectedIdleTime);
/* Re-enable interrupts to allow the interrupt that brought the MCU
out of sleep mode to execute immediately. */
__enable_irq();
/* Make sure interrupt enable is executed */
__RWMB();
__FENCE_I();
__NOP();
/* Disable interrupts again because the clock is about to be stopped
and interrupts that execute while the clock is stopped will increase
any slippage between the time maintained by the RTOS and calendar
time. */
__disable_irq();
/* Disable the SysTick clock. Again,
the time the SysTick is stopped for is accounted for as best it can
be, but using the tickless mode will inevitably result in some tiny
drift of the time maintained by the kernel with respect to calendar
time*/
ECLIC_DisableIRQ(SysTimer_IRQn);
/* Determine if SysTimer Interrupt is not yet happened,
(in which case an interrupt other than the SysTick
must have brought the system out of sleep mode). */
if (SysTimer_GetLoadValue() >= (XLastLoadValue + ulReloadValue)) {
/* As the pending tick will be processed as soon as this
function exits, the tick value maintained by the tick is stepped
forward by one less than the time spent waiting. */
ulCompleteTickPeriods = xExpectedIdleTime - 1UL;
FREERTOS_PORT_DEBUG("TickLess - SysTimer Interrupt Entered!\n");
} else {
/* Something other than the tick interrupt ended the sleep.
Work out how long the sleep lasted rounded to complete tick
periods (not the ulReload value which accounted for part
ticks). */
xModifiableIdleTime = SysTimer_GetLoadValue();
if (xModifiableIdleTime > XLastLoadValue) {
ulCompletedSysTickDecrements = (xModifiableIdleTime - XLastLoadValue);
} else {
ulCompletedSysTickDecrements = (xModifiableIdleTime + portMAX_BIT_NUMBER - XLastLoadValue);
}
/* How many complete tick periods passed while the processor
was waiting? */
ulCompleteTickPeriods = ulCompletedSysTickDecrements / ulTimerCountsForOneTick;
/* The reload value is set to whatever fraction of a single tick
period remains. */
SysTick_Reload(ulTimerCountsForOneTick);
FREERTOS_PORT_DEBUG("TickLess - External Interrupt Happened!\n");
}
FREERTOS_PORT_DEBUG("End TickLess %d\n", (uint32_t)ulCompleteTickPeriods);
/* Restart SysTick */
vTaskStepTick(ulCompleteTickPeriods);
/* Exit with interrupts enabled. */
ECLIC_EnableIRQ(SysTimer_IRQn);
__enable_irq();
}
/* Not implemented. */
for (;;)
;
}
#endif /* #if configUSE_TICKLESS_IDLE */
/*-----------------------------------------------------------*/
void irq_entry(uint32_t mcause) {
uint32_t ulInterruptNumber;
typedef void (*irq_handler_t)(void);
extern const irq_handler_t vector_base[];
/*
* Setup the systick timer to generate the tick interrupts at the required
* frequency.
*/
__attribute__((weak)) void vPortSetupTimerInterrupt(void) {
/* Calculate the constants required to configure the tick interrupt. */
#if (configUSE_TICKLESS_IDLE == 1)
{
ulTimerCountsForOneTick = (SYSTICK_TICK_CONST);
xMaximumPossibleSuppressedTicks = portMAX_BIT_NUMBER / ulTimerCountsForOneTick;
ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR / (configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ);
FREERTOS_PORT_DEBUG("CountsForOneTick, SuppressedTicks and TimerCompensation: %u, %u, %u\n", (uint32_t)ulTimerCountsForOneTick, (uint32_t)xMaximumPossibleSuppressedTicks,
(uint32_t)ulStoppedTimerCompensation);
}
#endif /* configUSE_TICKLESS_IDLE */
TickType_t ticks = SYSTICK_TICK_CONST;
ulInterruptNumber = mcause & 0xFFF;
/* Make SWI and SysTick the lowest priority interrupts. */
/* Stop and clear the SysTimer. SysTimer as Non-Vector Interrupt */
SysTick_Config(ticks);
ECLIC_DisableIRQ(SysTimer_IRQn);
ECLIC_SetLevelIRQ(SysTimer_IRQn, configKERNEL_INTERRUPT_PRIORITY);
ECLIC_SetShvIRQ(SysTimer_IRQn, ECLIC_NON_VECTOR_INTERRUPT);
ECLIC_EnableIRQ(SysTimer_IRQn);
/* Set SWI interrupt level to lowest level/priority, SysTimerSW as Vector Interrupt */
ECLIC_SetShvIRQ(SysTimerSW_IRQn, ECLIC_VECTOR_INTERRUPT);
ECLIC_SetLevelIRQ(SysTimerSW_IRQn, configKERNEL_INTERRUPT_PRIORITY);
ECLIC_EnableIRQ(SysTimerSW_IRQn);
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
#if (configASSERT_DEFINED == 1)
void vPortValidateInterruptPriority(void) {
uint32_t ulCurrentInterrupt;
uint8_t ucCurrentPriority;
/* Obtain the number of the currently executing interrupt. */
CSR_MCAUSE_Type mcause = (CSR_MCAUSE_Type)__RV_CSR_READ(CSR_MCAUSE);
/* Make sure current trap type is interrupt */
configASSERT(mcause.b.interrupt == 1);
if (mcause.b.interrupt) {
ulCurrentInterrupt = mcause.b.exccode;
/* Is the interrupt number a user defined interrupt? */
if (ulCurrentInterrupt >= portFIRST_USER_INTERRUPT_NUMBER) {
/* Look up the interrupt's priority. */
ucCurrentPriority = __ECLIC_GetLevelIRQ(ulCurrentInterrupt);
/* The following assertion will fail if a service routine (ISR) for
an interrupt that has been assigned a priority above
ucMaxSysCallPriority calls an ISR safe FreeRTOS API
function. ISR safe FreeRTOS API functions must *only* be called
from interrupts that have been assigned a priority at or below
ucMaxSysCallPriority.
Numerically low interrupt priority numbers represent logically high
interrupt priorities, therefore the priority of the interrupt must
be set to a value equal to or numerically *higher* than
ucMaxSysCallPriority.
Interrupts that use the FreeRTOS API must not be left at their
default priority of zero as that is the highest possible priority,
which is guaranteed to be above ucMaxSysCallPriority,
and therefore also guaranteed to be invalid.
FreeRTOS maintains separate thread and ISR API functions to ensure
interrupt entry is as fast and simple as possible.
The following links provide detailed information:
http://www.freertos.org/FAQHelp.html */
configASSERT(ucCurrentPriority <= ucMaxSysCallPriority);
}
if (vector_base[ulInterruptNumber]) {
vector_base[ulInterruptNumber]();
}
}
#endif /* configASSERT_DEFINED */

View File

@@ -1,4 +1,3 @@
/*
* FreeRTOS Kernel V10.2.1
* Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -26,377 +25,402 @@
* 1 tab == 4 spaces!
*/
#include "riscv_encoding.h"
#ifndef __riscv_32e
#define portRegNum 30
/*
* The FreeRTOS kernel's RISC-V port is split between the the code that is
* common across all currently supported RISC-V chips (implementations of the
* RISC-V ISA), and code which tailors the port to a specific RISC-V chip:
*
* + The code that is common to all RISC-V chips is implemented in
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S. There is only one
* portASM.S file because the same file is used no matter which RISC-V chip is
* in use.
*
* + The code that tailors the kernel's RISC-V port to a specific RISC-V
* chip is implemented in freertos_risc_v_chip_specific_extensions.h. There
* is one freertos_risc_v_chip_specific_extensions.h that can be used with any
* RISC-V chip that both includes a standard CLINT and does not add to the
* base set of RISC-V registers. There are additional
* freertos_risc_v_chip_specific_extensions.h files for RISC-V implementations
* that do not include a standard CLINT or do add to the base set of RISC-V
* registers.
*
* CARE MUST BE TAKEN TO INCLDUE THE CORRECT
* freertos_risc_v_chip_specific_extensions.h HEADER FILE FOR THE CHIP
* IN USE. To include the correct freertos_risc_v_chip_specific_extensions.h
* header file ensure the path to the correct header file is in the assembler's
* include path.
*
* This freertos_risc_v_chip_specific_extensions.h is for use on RISC-V chips
* that include a standard CLINT and do not add to the base set of RISC-V
* registers.
*
*/
#if __riscv_xlen == 64
#define portWORD_SIZE 8
#define store_x sd
#define load_x ld
#elif __riscv_xlen == 32
#define store_x sw
#define load_x lw
#define portWORD_SIZE 4
#else
#define portRegNum 14
#error Assembler did not define __riscv_xlen
#endif
#define portCONTEXT_SIZE ( portRegNum * REGBYTES )
#include "freertos_risc_v_chip_specific_extensions.h"
.section .text.entry
.align 8
/* Check the freertos_risc_v_chip_specific_extensions.h and/or command line
definitions. */
#ifndef portasmHAS_CLINT
#error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_CLINT to either 1 (CLINT present) or 0 (clint not present).
#endif
.extern xPortTaskSwitch
#ifndef portasmHANDLE_INTERRUPT
#error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts. portasmHANDLE_INTERRUPT can be defined on the assmbler command line or in the appropriate freertos_risc_v_chip_specific_extensions.h header file.
#endif
/* Only the standard core registers are stored by default. Any additional
registers must be saved by the portasmSAVE_ADDITIONAL_REGISTERS and
portasmRESTORE_ADDITIONAL_REGISTERS macros - which can be defined in a chip
specific version of freertos_risc_v_chip_specific_extensions.h. See the notes
at the top of this file. */
#define portCONTEXT_SIZE ( 30 * portWORD_SIZE )
.global xPortStartFirstTask
.global freertos_risc_v_trap_handler
.global pxPortInitialiseStack
.extern pxCurrentTCB
.global prvPortStartFirstTask
.extern ulPortTrapHandler
.extern vTaskSwitchContext
.extern Timer_IRQHandler
.extern pullMachineTimerCompareRegister
.extern pullNextTime
.extern uxTimerIncrementsForOneTick /* size_t type so 32-bit on 32-bit core and 64-bits on 64-bit core. */
.extern xISRStackTop
/**
* \brief Global interrupt disabled
* \details
* This function disable global interrupt.
* \remarks
* - All the interrupt requests will be ignored by CPU.
/*-----------------------------------------------------------*/
.align 8
.func
freertos_risc_v_trap_handler:
addi sp, sp, -portCONTEXT_SIZE
store_x x1, 1 * portWORD_SIZE( sp )
store_x x5, 2 * portWORD_SIZE( sp )
store_x x6, 3 * portWORD_SIZE( sp )
store_x x7, 4 * portWORD_SIZE( sp )
store_x x8, 5 * portWORD_SIZE( sp )
store_x x9, 6 * portWORD_SIZE( sp )
store_x x10, 7 * portWORD_SIZE( sp )
store_x x11, 8 * portWORD_SIZE( sp )
store_x x12, 9 * portWORD_SIZE( sp )
store_x x13, 10 * portWORD_SIZE( sp )
store_x x14, 11 * portWORD_SIZE( sp )
store_x x15, 12 * portWORD_SIZE( sp )
store_x x16, 13 * portWORD_SIZE( sp )
store_x x17, 14 * portWORD_SIZE( sp )
store_x x18, 15 * portWORD_SIZE( sp )
store_x x19, 16 * portWORD_SIZE( sp )
store_x x20, 17 * portWORD_SIZE( sp )
store_x x21, 18 * portWORD_SIZE( sp )
store_x x22, 19 * portWORD_SIZE( sp )
store_x x23, 20 * portWORD_SIZE( sp )
store_x x24, 21 * portWORD_SIZE( sp )
store_x x25, 22 * portWORD_SIZE( sp )
store_x x26, 23 * portWORD_SIZE( sp )
store_x x27, 24 * portWORD_SIZE( sp )
store_x x28, 25 * portWORD_SIZE( sp )
store_x x29, 26 * portWORD_SIZE( sp )
store_x x30, 27 * portWORD_SIZE( sp )
store_x x31, 28 * portWORD_SIZE( sp )
csrr t0, mstatus /* Required for MPIE bit. */
store_x t0, 29 * portWORD_SIZE( sp )
portasmSAVE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_chip_specific_extensions.h to save any registers unique to the RISC-V implementation. */
load_x t0, pxCurrentTCB /* Load pxCurrentTCB. */
store_x sp, 0( t0 ) /* Write sp to first TCB member. */
csrr a0, mcause
csrr a1, mepc
test_if_asynchronous:
srli a2, a0, __riscv_xlen - 1 /* MSB of mcause is 1 if handing an asynchronous interrupt - shift to LSB to clear other bits. */
beq a2, x0, handle_synchronous /* Branch past interrupt handing if not asynchronous. */
store_x a1, 0( sp ) /* Asynch so save unmodified exception return address. */
handle_asynchronous:
#if( portasmHAS_CLINT != 0 )
test_if_mtimer: /* If there is a CLINT then the mtimer is used to generate the tick interrupt. */
addi t0, x0, 1
slli t0, t0, __riscv_xlen - 1 /* LSB is already set, shift into MSB. Shift 31 on 32-bit or 63 on 64-bit cores. */
addi t1, t0, 7 /* 0x8000[]0007 == machine timer interrupt. */
bne a0, t1, test_if_external_interrupt
load_x t0, pullMachineTimerCompareRegister /* Load address of compare register into t0. */
load_x t1, pullNextTime /* Load the address of ullNextTime into t1. */
#if( __riscv_xlen == 32 )
/* Update the 64-bit mtimer compare match value in two 32-bit writes. */
lw t2, 0(t1) /* Load the low word of ullNextTime into t2. */
lw t3, 4(t1) /* Load the high word of ullNextTime into t3. */
sw t2, 0(t0) /* Store low word of ullNextTime into compare register. */
sw t3, 4(t0) /* Store high word of ullNextTime into compare register. */
lw t0, uxTimerIncrementsForOneTick /* Load the value of ullTimerIncrementForOneTick into t0 (could this be optimized by storing in an array next to pullNextTime?). */
add t4, t0, t2 /* Add the low word of ullNextTime to the timer increments for one tick (assumes timer increment for one tick fits in 32-bits). */
sltu t5, t4, t2 /* See if the sum of low words overflowed (what about the zero case?). */
add t6, t3, t5 /* Add overflow to high word of ullNextTime. */
sw t4, 0(t1) /* Store new low word of ullNextTime. */
sw t6, 4(t1) /* Store new high word of ullNextTime. */
#endif /* __riscv_xlen == 32 */
#if( __riscv_xlen == 64 )
/* Update the 64-bit mtimer compare match value. */
ld t2, 0(t1) /* Load ullNextTime into t2. */
sd t2, 0(t0) /* Store ullNextTime into compare register. */
ld t0, uxTimerIncrementsForOneTick /* Load the value of ullTimerIncrementForOneTick into t0 (could this be optimized by storing in an array next to pullNextTime?). */
add t4, t0, t2 /* Add ullNextTime to the timer increments for one tick. */
sd t4, 0(t1) /* Store ullNextTime. */
#endif /* __riscv_xlen == 64 */
load_x sp, xISRStackTop /* Switch to ISR stack before function call. */
jal xTaskIncrementTick
beqz a0, processed_source /* Don't switch context if incrementing tick didn't unblock a task. */
jal vTaskSwitchContext
j processed_source
test_if_external_interrupt: /* If there is a CLINT and the mtimer interrupt is not pending then check to see if an external interrupt is pending. */
addi t1, t1, 4 /* 0x80000007 + 4 = 0x8000000b == Machine external interrupt. */
bne a0, t1, as_yet_unhandled /* Something as yet unhandled. */
#endif /* portasmHAS_CLINT */
load_x sp, xISRStackTop /* Switch to ISR stack before function call. */
jal portasmHANDLE_INTERRUPT /* Jump to the interrupt handler if there is no CLINT or if there is a CLINT and it has been determined that an external interrupt is pending. */
j processed_source
handle_synchronous:
addi a1, a1, 4 /* Synchronous so updated exception return address to the instruction after the instruction that generated the exeption. */
store_x a1, 0( sp ) /* Save updated exception return address. */
test_if_environment_call:
li t0, 11 /* 11 == environment call. */
#if( portasmMCAUSE_MASK != 0) // FIXME hkim
li t1, portasmMCAUSE_MASK
and a0, a0, t1
#endif
bne a0, t0, is_exception /* Not an M environment call, so some other exception. */
load_x sp, xISRStackTop /* Switch to ISR stack before function call. */
jal vTaskSwitchContext
j processed_source
is_exception:
ebreak
j is_exception
as_yet_unhandled:
ebreak
j as_yet_unhandled
processed_source:
load_x t1, pxCurrentTCB /* Load pxCurrentTCB. */
load_x sp, 0( t1 ) /* Read sp from first TCB member. */
/* Load mret with the address of the next instruction in the task to run next. */
load_x t0, 0( sp )
csrw mepc, t0
portasmRESTORE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_chip_specific_extensions.h to restore any registers unique to the RISC-V implementation. */
/* Load mstatus with the interrupt enable bits used by the task. */
load_x t0, 29 * portWORD_SIZE( sp )
csrw mstatus, t0 /* Required for MPIE bit. */
load_x x1, 1 * portWORD_SIZE( sp )
load_x x5, 2 * portWORD_SIZE( sp ) /* t0 */
load_x x6, 3 * portWORD_SIZE( sp ) /* t1 */
load_x x7, 4 * portWORD_SIZE( sp ) /* t2 */
load_x x8, 5 * portWORD_SIZE( sp ) /* s0/fp */
load_x x9, 6 * portWORD_SIZE( sp ) /* s1 */
load_x x10, 7 * portWORD_SIZE( sp ) /* a0 */
load_x x11, 8 * portWORD_SIZE( sp ) /* a1 */
load_x x12, 9 * portWORD_SIZE( sp ) /* a2 */
load_x x13, 10 * portWORD_SIZE( sp ) /* a3 */
load_x x14, 11 * portWORD_SIZE( sp ) /* a4 */
load_x x15, 12 * portWORD_SIZE( sp ) /* a5 */
load_x x16, 13 * portWORD_SIZE( sp ) /* a6 */
load_x x17, 14 * portWORD_SIZE( sp ) /* a7 */
load_x x18, 15 * portWORD_SIZE( sp ) /* s2 */
load_x x19, 16 * portWORD_SIZE( sp ) /* s3 */
load_x x20, 17 * portWORD_SIZE( sp ) /* s4 */
load_x x21, 18 * portWORD_SIZE( sp ) /* s5 */
load_x x22, 19 * portWORD_SIZE( sp ) /* s6 */
load_x x23, 20 * portWORD_SIZE( sp ) /* s7 */
load_x x24, 21 * portWORD_SIZE( sp ) /* s8 */
load_x x25, 22 * portWORD_SIZE( sp ) /* s9 */
load_x x26, 23 * portWORD_SIZE( sp ) /* s10 */
load_x x27, 24 * portWORD_SIZE( sp ) /* s11 */
load_x x28, 25 * portWORD_SIZE( sp ) /* t3 */
load_x x29, 26 * portWORD_SIZE( sp ) /* t4 */
load_x x30, 27 * portWORD_SIZE( sp ) /* t5 */
load_x x31, 28 * portWORD_SIZE( sp ) /* t6 */
addi sp, sp, portCONTEXT_SIZE
mret
.endfunc
/*-----------------------------------------------------------*/
.align 8
.func
xPortStartFirstTask:
#if( portasmHAS_CLINT != 0 )
/* If there is a clint then interrupts can branch directly to the FreeRTOS
trap handler. Otherwise the interrupt controller will need to be configured
outside of this file. */
la t0, freertos_risc_v_trap_handler
csrw mtvec, t0
#endif /* portasmHAS_CLILNT */
load_x sp, pxCurrentTCB /* Load pxCurrentTCB. */
load_x sp, 0( sp ) /* Read sp from first TCB member. */
load_x x1, 0( sp ) /* Note for starting the scheduler the exception return address is used as the function return address. */
portasmRESTORE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_chip_specific_extensions.h to restore any registers unique to the RISC-V implementation. */
load_x t0, 29 * portWORD_SIZE( sp ) /* mstatus */
csrrw x0, mstatus, t0 /* Interrupts enabled from here! */
load_x x5, 2 * portWORD_SIZE( sp ) /* t0 */
load_x x6, 3 * portWORD_SIZE( sp ) /* t1 */
load_x x7, 4 * portWORD_SIZE( sp ) /* t2 */
load_x x8, 5 * portWORD_SIZE( sp ) /* s0/fp */
load_x x9, 6 * portWORD_SIZE( sp ) /* s1 */
load_x x10, 7 * portWORD_SIZE( sp ) /* a0 */
load_x x11, 8 * portWORD_SIZE( sp ) /* a1 */
load_x x12, 9 * portWORD_SIZE( sp ) /* a2 */
load_x x13, 10 * portWORD_SIZE( sp ) /* a3 */
load_x x14, 11 * portWORD_SIZE( sp ) /* a4 */
load_x x15, 12 * portWORD_SIZE( sp ) /* a5 */
load_x x16, 13 * portWORD_SIZE( sp ) /* a6 */
load_x x17, 14 * portWORD_SIZE( sp ) /* a7 */
load_x x18, 15 * portWORD_SIZE( sp ) /* s2 */
load_x x19, 16 * portWORD_SIZE( sp ) /* s3 */
load_x x20, 17 * portWORD_SIZE( sp ) /* s4 */
load_x x21, 18 * portWORD_SIZE( sp ) /* s5 */
load_x x22, 19 * portWORD_SIZE( sp ) /* s6 */
load_x x23, 20 * portWORD_SIZE( sp ) /* s7 */
load_x x24, 21 * portWORD_SIZE( sp ) /* s8 */
load_x x25, 22 * portWORD_SIZE( sp ) /* s9 */
load_x x26, 23 * portWORD_SIZE( sp ) /* s10 */
load_x x27, 24 * portWORD_SIZE( sp ) /* s11 */
load_x x28, 25 * portWORD_SIZE( sp ) /* t3 */
load_x x29, 26 * portWORD_SIZE( sp ) /* t4 */
load_x x30, 27 * portWORD_SIZE( sp ) /* t5 */
load_x x31, 28 * portWORD_SIZE( sp ) /* t6 */
addi sp, sp, portCONTEXT_SIZE
ret
.endfunc
/*-----------------------------------------------------------*/
/*
* Unlike other ports pxPortInitialiseStack() is written in assembly code as it
* needs access to the portasmADDITIONAL_CONTEXT_SIZE constant. The prototype
* for the function is as per the other ports:
* StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters );
*
* As per the standard RISC-V ABI pxTopcOfStack is passed in in a0, pxCode in
* a1, and pvParameters in a2. The new top of stack is passed out in a0.
*
* RISC-V maps registers to ABI names as follows (X1 to X31 integer registers
* for the 'I' profile, X1 to X15 for the 'E' profile, currently I assumed).
*
* Register ABI Name Description Saver
* x0 zero Hard-wired zero -
* x1 ra Return address Caller
* x2 sp Stack pointer Callee
* x3 gp Global pointer -
* x4 tp Thread pointer -
* x5-7 t0-2 Temporaries Caller
* x8 s0/fp Saved register/Frame pointer Callee
* x9 s1 Saved register Callee
* x10-11 a0-1 Function Arguments/return values Caller
* x12-17 a2-7 Function arguments Caller
* x18-27 s2-11 Saved registers Callee
* x28-31 t3-6 Temporaries Caller
*
* The RISC-V context is saved t FreeRTOS tasks in the following stack frame,
* where the global and thread pointers are currently assumed to be constant so
* are not saved:
*
* mstatus
* x31
* x30
* x29
* x28
* x27
* x26
* x25
* x24
* x23
* x22
* x21
* x20
* x19
* x18
* x17
* x16
* x15
* x14
* x13
* x12
* x11
* pvParameters
* x9
* x8
* x7
* x6
* x5
* portTASK_RETURN_ADDRESS
* [chip specific registers go here]
* pxCode
*/
.macro DISABLE_MIE
csrc CSR_MSTATUS, MSTATUS_MIE
.endm
.align 8
.func
pxPortInitialiseStack:
/**
* \brief Macro for context save
* \details
* This macro save ABI defined caller saved registers in the stack.
* \remarks
* - This Macro could use to save context when you enter to interrupt
* or exception
*/
/* Save caller registers */
.macro SAVE_CONTEXT
csrrw sp, CSR_MSCRATCHCSWL, sp
/* Allocate stack space for context saving */
#ifndef __riscv_32e
addi sp, sp, -20*REGBYTES
#else
addi sp, sp, -14*REGBYTES
#endif /* __riscv_32e */
csrr t0, mstatus /* Obtain current mstatus value. */
addi t1, x0, 0x188 /* Generate the value 0x1880, which are the MPIE and MPP bits to set in mstatus. */
slli t1, t1, 4
or t0, t0, t1 /* Set MPIE and MPP bits in mstatus value. */
STORE x1, 0*REGBYTES(sp)
STORE x4, 1*REGBYTES(sp)
STORE x5, 2*REGBYTES(sp)
STORE x6, 3*REGBYTES(sp)
STORE x7, 4*REGBYTES(sp)
STORE x10, 5*REGBYTES(sp)
STORE x11, 6*REGBYTES(sp)
STORE x12, 7*REGBYTES(sp)
STORE x13, 8*REGBYTES(sp)
STORE x14, 9*REGBYTES(sp)
STORE x15, 10*REGBYTES(sp)
#ifndef __riscv_32e
STORE x16, 14*REGBYTES(sp)
STORE x17, 15*REGBYTES(sp)
STORE x28, 16*REGBYTES(sp)
STORE x29, 17*REGBYTES(sp)
STORE x30, 18*REGBYTES(sp)
STORE x31, 19*REGBYTES(sp)
#endif /* __riscv_32e */
.endm
/**
* \brief Macro for restore caller registers
* \details
* This macro restore ABI defined caller saved registers from stack.
* \remarks
* - You could use this macro to restore context before you want return
* from interrupt or exeception
*/
/* Restore caller registers */
.macro RESTORE_CONTEXT
LOAD x1, 0*REGBYTES(sp)
LOAD x4, 1*REGBYTES(sp)
LOAD x5, 2*REGBYTES(sp)
LOAD x6, 3*REGBYTES(sp)
LOAD x7, 4*REGBYTES(sp)
LOAD x10, 5*REGBYTES(sp)
LOAD x11, 6*REGBYTES(sp)
LOAD x12, 7*REGBYTES(sp)
LOAD x13, 8*REGBYTES(sp)
LOAD x14, 9*REGBYTES(sp)
LOAD x15, 10*REGBYTES(sp)
#ifndef __riscv_32e
LOAD x16, 14*REGBYTES(sp)
LOAD x17, 15*REGBYTES(sp)
LOAD x28, 16*REGBYTES(sp)
LOAD x29, 17*REGBYTES(sp)
LOAD x30, 18*REGBYTES(sp)
LOAD x31, 19*REGBYTES(sp)
/* De-allocate the stack space */
addi sp, sp, 20*REGBYTES
#else
/* De-allocate the stack space */
addi sp, sp, 14*REGBYTES
#endif /* __riscv_32e */
csrrw sp, CSR_MSCRATCHCSWL, sp
.endm
/**
* \brief Macro for save necessary CSRs to stack
* \details
* This macro store MCAUSE, MEPC, MSUBM to stack.
*/
.macro SAVE_CSR_CONTEXT
/* Store CSR mcause to stack using pushmcause */
csrrwi x0, CSR_PUSHMCAUSE, 11
/* Store CSR mepc to stack using pushmepc */
csrrwi x0, CSR_PUSHMEPC, 12
/* Store CSR msub to stack using pushmsub */
csrrwi x0, CSR_PUSHMSUBM, 13
.endm
/**
* \brief Macro for restore necessary CSRs from stack
* \details
* This macro restore MSUBM, MEPC, MCAUSE from stack.
*/
.macro RESTORE_CSR_CONTEXT
LOAD x5, 13*REGBYTES(sp)
csrw CSR_MSUBM, x5
LOAD x5, 12*REGBYTES(sp)
csrw CSR_MEPC, x5
LOAD x5, 11*REGBYTES(sp)
csrw CSR_MCAUSE, x5
.endm
/**
* \brief Exception/NMI Entry
* \details
* This function provide common entry functions for exception/nmi.
* \remarks
* This function provide a default exception/nmi entry.
* ABI defined caller save register and some CSR registers
* to be saved before enter interrupt handler and be restored before return.
*/
.section .text.trap
/* In CLIC mode, the exeception entry must be 64bytes aligned */
.align 6
.global exc_entry
exc_entry:
/* Save the caller saving registers (context) */
SAVE_CONTEXT
/* Save the necessary CSR registers */
SAVE_CSR_CONTEXT
/*
* Set the exception handler function arguments
* argument 1: mcause value
* argument 2: current stack point(SP) value
*/
csrr a0, mcause
mv a1, sp
/*
* TODO: Call the exception handler function
* By default, the function template is provided in
* system_Device.c, you can adjust it as you want
*/
call core_exception_handler
/* Restore the necessary CSR registers */
RESTORE_CSR_CONTEXT
/* Restore the caller saving registers (context) */
RESTORE_CONTEXT
/* Return to regular code */
mret
/**
* \brief Non-Vector Interrupt Entry
* \details
* This function provide common entry functions for handling
* non-vector interrupts
* \remarks
* This function provide a default non-vector interrupt entry.
* ABI defined caller save register and some CSR registers need
* to be saved before enter interrupt handler and be restored before return.
*/
.section .text.irq
/* In CLIC mode, the interrupt entry must be 4bytes aligned */
.align 2
.global irq_entry
/* This label will be set to MTVT2 register */
irq_entry:
/* Save the caller saving registers (context) */
SAVE_CONTEXT
/* Save the necessary CSR registers */
SAVE_CSR_CONTEXT
/* This special CSR read/write operation, which is actually
* claim the CLIC to find its pending highest ID, if the ID
* is not 0, then automatically enable the mstatus.MIE, and
* jump to its vector-entry-label, and update the link register
*/
csrrw ra, CSR_JALMNXTI, ra
/* Critical section with interrupts disabled */
DISABLE_MIE
/* Restore the necessary CSR registers */
RESTORE_CSR_CONTEXT
/* Restore the caller saving registers (context) */
RESTORE_CONTEXT
/* Return to regular code */
mret
/* Default Handler for Exceptions / Interrupts */
.global default_intexc_handler
Undef_Handler:
default_intexc_handler:
addi a0, a0, -portWORD_SIZE
store_x t0, 0(a0) /* mstatus onto the stack. */
addi a0, a0, -(22 * portWORD_SIZE) /* Space for registers x11-x31. */
store_x a2, 0(a0) /* Task parameters (pvParameters parameter) goes into register X10/a0 on the stack. */
addi a0, a0, -(6 * portWORD_SIZE) /* Space for registers x5-x9. */
store_x x0, 0(a0) /* Return address onto the stack, could be portTASK_RETURN_ADDRESS */
addi t0, x0, portasmADDITIONAL_CONTEXT_SIZE /* The number of chip specific additional registers. */
chip_specific_stack_frame: /* First add any chip specific registers to the stack frame being created. */
beq t0, x0, 1f /* No more chip specific registers to save. */
addi a0, a0, -portWORD_SIZE /* Make space for chip specific register. */
store_x x0, 0(a0) /* Give the chip specific register an initial value of zero. */
addi t0, t0, -1 /* Decrement the count of chip specific registers remaining. */
j chip_specific_stack_frame /* Until no more chip specific registers. */
1:
j 1b
/* Start the first task. This also clears the bit that indicates the FPU is
in use in case the FPU was used before the scheduler was started - which
would otherwise result in the unnecessary leaving of space in the stack
for lazy saving of FPU registers. */
.align 3
prvPortStartFirstTask:
/* Setup Interrupt Stack using
The stack that was used by main()
before the scheduler is started is
no longer required after the scheduler is started.
Interrupt stack pointer is stored in CSR_MSCRATCH */
la t0, _sp
csrw CSR_MSCRATCH, t0
LOAD sp, pxCurrentTCB /* Load pxCurrentTCB. */
LOAD sp, 0x0(sp) /* Read sp from first TCB member */
/* Pop PC from stack and set MEPC */
LOAD t0, 0 * REGBYTES(sp)
csrw CSR_MEPC, t0
/* Pop mstatus from stack and set it */
LOAD t0, (portRegNum - 1) * REGBYTES(sp)
csrw CSR_MSTATUS, t0
/* Interrupt still disable here */
/* Restore Registers from Stack */
LOAD x1, 1 * REGBYTES(sp) /* RA */
LOAD x5, 2 * REGBYTES(sp)
LOAD x6, 3 * REGBYTES(sp)
LOAD x7, 4 * REGBYTES(sp)
LOAD x8, 5 * REGBYTES(sp)
LOAD x9, 6 * REGBYTES(sp)
LOAD x10, 7 * REGBYTES(sp)
LOAD x11, 8 * REGBYTES(sp)
LOAD x12, 9 * REGBYTES(sp)
LOAD x13, 10 * REGBYTES(sp)
LOAD x14, 11 * REGBYTES(sp)
LOAD x15, 12 * REGBYTES(sp)
#ifndef __riscv_32e
LOAD x16, 13 * REGBYTES(sp)
LOAD x17, 14 * REGBYTES(sp)
LOAD x18, 15 * REGBYTES(sp)
LOAD x19, 16 * REGBYTES(sp)
LOAD x20, 17 * REGBYTES(sp)
LOAD x21, 18 * REGBYTES(sp)
LOAD x22, 19 * REGBYTES(sp)
LOAD x23, 20 * REGBYTES(sp)
LOAD x24, 21 * REGBYTES(sp)
LOAD x25, 22 * REGBYTES(sp)
LOAD x26, 23 * REGBYTES(sp)
LOAD x27, 24 * REGBYTES(sp)
LOAD x28, 25 * REGBYTES(sp)
LOAD x29, 26 * REGBYTES(sp)
LOAD x30, 27 * REGBYTES(sp)
LOAD x31, 28 * REGBYTES(sp)
#endif
addi sp, sp, portCONTEXT_SIZE
mret
.align 2
.global eclic_msip_handler
eclic_msip_handler:
addi sp, sp, -portCONTEXT_SIZE
STORE x1, 1 * REGBYTES(sp) /* RA */
STORE x5, 2 * REGBYTES(sp)
STORE x6, 3 * REGBYTES(sp)
STORE x7, 4 * REGBYTES(sp)
STORE x8, 5 * REGBYTES(sp)
STORE x9, 6 * REGBYTES(sp)
STORE x10, 7 * REGBYTES(sp)
STORE x11, 8 * REGBYTES(sp)
STORE x12, 9 * REGBYTES(sp)
STORE x13, 10 * REGBYTES(sp)
STORE x14, 11 * REGBYTES(sp)
STORE x15, 12 * REGBYTES(sp)
#ifndef __riscv_32e
STORE x16, 13 * REGBYTES(sp)
STORE x17, 14 * REGBYTES(sp)
STORE x18, 15 * REGBYTES(sp)
STORE x19, 16 * REGBYTES(sp)
STORE x20, 17 * REGBYTES(sp)
STORE x21, 18 * REGBYTES(sp)
STORE x22, 19 * REGBYTES(sp)
STORE x23, 20 * REGBYTES(sp)
STORE x24, 21 * REGBYTES(sp)
STORE x25, 22 * REGBYTES(sp)
STORE x26, 23 * REGBYTES(sp)
STORE x27, 24 * REGBYTES(sp)
STORE x28, 25 * REGBYTES(sp)
STORE x29, 26 * REGBYTES(sp)
STORE x30, 27 * REGBYTES(sp)
STORE x31, 28 * REGBYTES(sp)
#endif
/* Push mstatus to stack */
csrr t0, CSR_MSTATUS
STORE t0, (portRegNum - 1) * REGBYTES(sp)
/* Push additional registers */
/* Store sp to task stack */
LOAD t0, pxCurrentTCB
STORE sp, 0(t0)
csrr t0, CSR_MEPC
STORE t0, 0(sp)
jal xPortTaskSwitch
/* Switch task context */
LOAD t0, pxCurrentTCB /* Load pxCurrentTCB. */
LOAD sp, 0x0(t0) /* Read sp from first TCB member */
/* Pop PC from stack and set MEPC */
LOAD t0, 0 * REGBYTES(sp)
csrw CSR_MEPC, t0
/* Pop additional registers */
/* Pop mstatus from stack and set it */
LOAD t0, (portRegNum - 1) * REGBYTES(sp)
csrw CSR_MSTATUS, t0
/* Interrupt still disable here */
/* Restore Registers from Stack */
LOAD x1, 1 * REGBYTES(sp) /* RA */
LOAD x5, 2 * REGBYTES(sp)
LOAD x6, 3 * REGBYTES(sp)
LOAD x7, 4 * REGBYTES(sp)
LOAD x8, 5 * REGBYTES(sp)
LOAD x9, 6 * REGBYTES(sp)
LOAD x10, 7 * REGBYTES(sp)
LOAD x11, 8 * REGBYTES(sp)
LOAD x12, 9 * REGBYTES(sp)
LOAD x13, 10 * REGBYTES(sp)
LOAD x14, 11 * REGBYTES(sp)
LOAD x15, 12 * REGBYTES(sp)
#ifndef __riscv_32e
LOAD x16, 13 * REGBYTES(sp)
LOAD x17, 14 * REGBYTES(sp)
LOAD x18, 15 * REGBYTES(sp)
LOAD x19, 16 * REGBYTES(sp)
LOAD x20, 17 * REGBYTES(sp)
LOAD x21, 18 * REGBYTES(sp)
LOAD x22, 19 * REGBYTES(sp)
LOAD x23, 20 * REGBYTES(sp)
LOAD x24, 21 * REGBYTES(sp)
LOAD x25, 22 * REGBYTES(sp)
LOAD x26, 23 * REGBYTES(sp)
LOAD x27, 24 * REGBYTES(sp)
LOAD x28, 25 * REGBYTES(sp)
LOAD x29, 26 * REGBYTES(sp)
LOAD x30, 27 * REGBYTES(sp)
LOAD x31, 28 * REGBYTES(sp)
#endif
addi sp, sp, portCONTEXT_SIZE
mret
addi a0, a0, -portWORD_SIZE
store_x a1, 0(a0) /* mret value (pxCode parameter) onto the stack. */
ret
.endfunc
/*-----------------------------------------------------------*/

View File

@@ -32,8 +32,6 @@
extern "C" {
#endif
#include "nuclei_sdk_soc.h"
/*-----------------------------------------------------------
* Port specific definitions.
*
@@ -45,61 +43,92 @@ extern "C" {
*/
/* Type definitions. */
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE unsigned long
#define portBASE_TYPE long
#define portPOINTER_SIZE_TYPE unsigned long
#if __riscv_xlen == 64
#define portSTACK_TYPE uint64_t
#define portBASE_TYPE int64_t
#define portUBASE_TYPE uint64_t
#define portMAX_DELAY (TickType_t)0xffffffffffffffffUL
#define portPOINTER_SIZE_TYPE uint64_t
#elif __riscv_xlen == 32
#define portSTACK_TYPE uint32_t
#define portBASE_TYPE int32_t
#define portUBASE_TYPE uint32_t
#define portMAX_DELAY (TickType_t)0xffffffffUL
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#else
#error Assembler did not define __riscv_xlen
#endif
typedef portSTACK_TYPE StackType_t;
typedef long BaseType_t;
typedef unsigned long UBaseType_t;
typedef portBASE_TYPE BaseType_t;
typedef portUBASE_TYPE UBaseType_t;
typedef portUBASE_TYPE TickType_t;
#if (configUSE_16_BIT_TICKS == 1)
typedef uint16_t TickType_t;
#define portMAX_DELAY (TickType_t)0xffff
#else
/* RISC-V TIMER is 64-bit long */
typedef uint64_t TickType_t;
#define portMAX_DELAY (TickType_t)0xFFFFFFFFFFFFFFFFULL
#endif
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
not need to be guarded with a critical section. */
#define portTICK_TYPE_IS_ATOMIC 1
/*-----------------------------------------------------------*/
/* Architecture specifics. */
#define portSTACK_GROWTH (-1)
#define portTICK_PERIOD_MS ((TickType_t)1000 / configTICK_RATE_HZ)
#ifdef __riscv64
#error This is the RV32 port that has not yet been adapted for 64.
#define portBYTE_ALIGNMENT 16
#else
#define portBYTE_ALIGNMENT 8
#endif
/*-----------------------------------------------------------*/
/* Scheduler utilities. */
#define portYIELD() \
{ \
/* Set a software interrupt(SWI) request to request a context switch. */ \
SysTimer_SetSWIRQ(); \
/* Barriers are normally not required but do ensure the code is completely \
within the specified behaviour for the architecture. */ \
__RWMB(); \
}
extern void vTaskSwitchContext(void);
#define portYIELD() __asm volatile("ecall");
#define portEND_SWITCHING_ISR(xSwitchRequired) \
if (xSwitchRequired != pdFALSE) \
portYIELD()
if (xSwitchRequired) \
vTaskSwitchContext()
#define portYIELD_FROM_ISR(x) portEND_SWITCHING_ISR(x)
/*-----------------------------------------------------------*/
/* Critical section management. */
extern void vPortEnterCritical(void);
extern void vPortExitCritical(void);
#define portCRITICAL_NESTING_IN_TCB 1
extern void vTaskEnterCritical(void);
extern void vTaskExitCritical(void);
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortRaiseBASEPRI()
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortSetBASEPRI(x)
#define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI()
#define portENABLE_INTERRUPTS() vPortSetBASEPRI(0)
#define portENTER_CRITICAL() vPortEnterCritical()
#define portEXIT_CRITICAL() vPortExitCritical()
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedStatusValue) (void)uxSavedStatusValue
#define portDISABLE_INTERRUPTS() __asm volatile("csrc mstatus, 8")
#define portENABLE_INTERRUPTS() __asm volatile("csrs mstatus, 8")
#define portENTER_CRITICAL() vTaskEnterCritical()
#define portEXIT_CRITICAL() vTaskExitCritical()
/*-----------------------------------------------------------*/
/* Architecture specific optimisations. */
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#endif
#if (configUSE_PORT_OPTIMISED_TASK_SELECTION == 1)
/* Check the configuration. */
#if (configMAX_PRIORITIES > 32)
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice.
#endif
/* Store/clear the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) |= (1UL << (uxPriority))
#define portRESET_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) &= ~(1UL << (uxPriority))
/*-----------------------------------------------------------*/
#define portGET_HIGHEST_PRIORITY(uxTopPriority, uxReadyPriorities) uxTopPriority = (31UL - __builtin_clz(uxReadyPriorities))
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
/*-----------------------------------------------------------*/
@@ -108,24 +137,10 @@ not necessary for to use this port. They are defined so the common demo files
(which build with all the ports) will build. */
#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters)
#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters)
/*-----------------------------------------------------------*/
/* Tickless idle/low power functionality. */
#ifndef portSUPPRESS_TICKS_AND_SLEEP
extern void vPortSuppressTicksAndSleep(TickType_t xExpectedIdleTime);
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) vPortSuppressTicksAndSleep(xExpectedIdleTime)
#endif
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
#ifdef configASSERT
extern void vPortValidateInterruptPriority(void);
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
#endif
/* portNOP() is not required by this port. */
#define portNOP() __NOP()
#define portNOP() __asm volatile(" nop ")
#define portINLINE __inline
@@ -133,37 +148,6 @@ extern void vPortValidateInterruptPriority(void);
#define portFORCE_INLINE inline __attribute__((always_inline))
#endif
/* This variable should not be set in any of the FreeRTOS application
only used internal of FreeRTOS Port code */
extern uint8_t uxMaxSysCallMTH;
/*-----------------------------------------------------------*/
portFORCE_INLINE static void vPortRaiseBASEPRI(void) {
ECLIC_SetMth(uxMaxSysCallMTH);
__RWMB();
}
/*-----------------------------------------------------------*/
portFORCE_INLINE static uint8_t ulPortRaiseBASEPRI(void) {
uint8_t ulOriginalBASEPRI;
ulOriginalBASEPRI = ECLIC_GetMth();
ECLIC_SetMth(uxMaxSysCallMTH);
__RWMB();
/* This return might not be reached but is necessary to prevent compiler
warnings. */
return ulOriginalBASEPRI;
}
/*-----------------------------------------------------------*/
portFORCE_INLINE static void vPortSetBASEPRI(uint8_t ulNewMaskValue) {
ECLIC_SetMth(ulNewMaskValue);
__RWMB();
}
/*-----------------------------------------------------------*/
#define portMEMORY_BARRIER() __asm volatile("" ::: "memory")
#ifdef __cplusplus

View File

@@ -1,48 +0,0 @@
adapter_khz 100
reset_config srst_only
adapter_nsrst_assert_width 100
interface cmsis-dap
transport select jtag
adapter_khz 100
autoexit true
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x1e200a6d
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 20480 -work-area-backup 0
# Work-area is a space in RAM used for flash programming
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x5000
}
# Allow overriding the Flash bank size
if { [info exists FLASH_SIZE] } {
set _FLASH_SIZE $FLASH_SIZE
} else {
# autodetect size
set _FLASH_SIZE 0
}
# flash size will be probed
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 0 $_TARGETNAME
# Expose Nuclei self-defined CSRS range 770-800,835-850,1984-2032,2064-2070
# See https://github.com/riscv/riscv-gnu-toolchain/issues/319#issuecomment-358397306
# Then user can view the csr register value in gdb using: info reg csr775 for CSR MTVT(0x307)
riscv expose_csrs 770-800,835-850,1984-2032,2064-2070
riscv set_reset_timeout_sec 1
init
halt

View File

@@ -1,4 +0,0 @@
#include "stub.h"
#include <errno.h>
int _close(int fd) { return _stub(EBADF); }

View File

@@ -1,6 +0,0 @@
#include "stub.h"
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
int _fstat(int fd, struct stat *st) { return _stub(EBADF); }

View File

@@ -1,13 +0,0 @@
#include "nuclei_sdk_soc.h"
#include <errno.h>
#include <sys/time.h>
int _gettimeofday(struct timeval *tp, void *tzp) {
uint64_t cycles;
cycles = __get_rv_cycle();
tp->tv_sec = cycles / SystemCoreClock;
tp->tv_usec = (cycles % SystemCoreClock) * 1000000 / SystemCoreClock;
return 0;
}

View File

@@ -1,11 +0,0 @@
/* See LICENSE of license details. */
#include <unistd.h>
int _isatty(int fd) {
if (fd == STDOUT_FILENO || fd == STDERR_FILENO) {
return 1;
}
return 0;
}

View File

@@ -1,6 +0,0 @@
#include "stub.h"
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
off_t _lseek(int fd, off_t ptr, int dir) { return _stub(EBADF); }

View File

@@ -1,9 +0,0 @@
#include "gd32vf103_usart.h"
#include <errno.h>
#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
// #define UART_AUTO_ECHO
ssize_t _read(int fd, void *ptr, size_t len) { return -1; }

View File

@@ -1,18 +0,0 @@
/* See LICENSE of license details. */
#include <stddef.h>
#include <stdint.h>
#include <unistd.h>
void *_sbrk(ptrdiff_t incr) {
extern char _end[];
extern char _heap_end[];
static char *curbrk = _end;
if ((curbrk + incr < _end) || (curbrk + incr > _heap_end)) {
return NULL - 1;
}
curbrk += incr;
return curbrk - incr;
}

View File

@@ -1,2 +0,0 @@
static inline int _stub(int err) { return -1; }

View File

@@ -1,6 +1,5 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
@@ -124,7 +123,7 @@
#define POWER_LIMIT_STEPS 5 //
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses TS100 resistors
#define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table
#define USB_PD_VMAX 21 // Maximum voltage for PD to negotiate
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
#define PID_TIM_HZ (8) // Tick rate of the PID loop
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
#define MAX_TEMP_F 850 // Max soldering temp selectable °F

View File

@@ -0,0 +1,6 @@
add_subdirectory(brieflz)
add_subdirectory(BSP)
add_subdirectory(Drivers)
add_subdirectory(LangSupport)
add_subdirectory(Src)
add_subdirectory(Threads)

View File

@@ -2,8 +2,18 @@
#include "BSP.h"
#include "Buttons.hpp"
#include "OLED.hpp"
#include "Settings.h"
#include "cmsis_os.h"
#define LOGO_PAGE_LENGTH 1024
void delay() {
if (getSettingValue(SettingsOptions::LOGOTime) == 5) {
waitForButtonPress();
} else {
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
}
}
void BootLogo::handleShowingLogo(const uint8_t *ptrLogoArea) {
// Read the first few bytes and figure out what format we are looking at
if (OLD_LOGO_HEADER_VALUE == *(reinterpret_cast<const uint32_t *>(ptrLogoArea))) {
@@ -21,7 +31,7 @@ void BootLogo::showOldFormat(const uint8_t *ptrLogoArea) {
OLED::refresh();
// Delay here until button is pressed or its been the amount of seconds set by the user
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
delay();
}
void BootLogo::showNewFormat(const uint8_t *ptrLogoArea) {
@@ -46,9 +56,9 @@ void BootLogo::showNewFormat(const uint8_t *ptrLogoArea) {
osDelay(interFrameDelay * 5);
}
// 1024 less the header type byte and the inter-frame-delay
if (getSettingValue(SettingsOptions::LOGOTime) < 5 && (position == 1022 || len == 0)) {
if (getSettingValue(SettingsOptions::LOGOTime) > 0 && (position == 1022 || len == 0)) {
// Delay here until button is pressed or its been the amount of seconds set by the user
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
delay();
return;
}
} while (buttons == BUTTON_NONE);

View File

@@ -0,0 +1,25 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(sources
BMA223.cpp
BootLogo.cpp
Buttons.cpp
I2CBB.cpp
LIS2DH12.cpp
MMA8652FC.cpp
MSA301.cpp
OLED.cpp
SC7A20.cpp
Si7210.cpp
TipThermoModel.cpp
usb-pd
USBPD.cpp
Utils.cpp
)
add_library(drivers ${sources})
target_link_libraries(drivers PRIVATE BSP BSPImplementation mainSource languages PUBLIC USBPDLib FreeRTOS)
target_include_directories(drivers PUBLIC .)
add_subdirectory(usb-pd)

View File

@@ -9,7 +9,7 @@
#ifndef FONT_H_
#define FONT_H_
#include "Translation.h"
#include <stdint.h>
#define FONT_12_WIDTH 12
// THE MAIN FONTS ARE NO LONGER HERE, MOVED TO PYTHON AUTO GEN
@@ -124,7 +124,7 @@ const uint8_t WarningBlock24[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x30, 0x0C, 0x02, 0xF1, 0xF1, 0xF1, 0x02, 0x0C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC0, 0xB0, 0x8C, 0x83, 0x80, 0x80, 0x80, 0x80, 0xB3, 0xB3, 0xB3, 0x80, 0x80, 0x80, 0x80, 0x83, 0x8C, 0xB0, 0xC0, 0x00, 0x00};
#if defined(MODEL_TS100) + defined(MODEL_Pinecil) >= 1
#if defined(MODEL_TS100) + defined(MODEL_Pinecil) > 0
const uint8_t buttonA[] = {
// width = 42
// height = 16
@@ -140,7 +140,7 @@ const uint8_t disconnectedTip[] = {
0x04, 0x31, 0x38, 0x1c, 0x0e, 0x04, 0x01, 0x03, 0x07, 0x0e, 0x1c, 0x39, 0x30, 0x01, 0x03, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x09, 0x0f, 0x00};
#endif
#if defined(MODEL_TS80) + defined(MODEL_TS80P) >= 1
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
const uint8_t buttonA[] = {
// width = 42
// height = 16

View File

@@ -423,6 +423,13 @@ inline void stripLeaderZeros(char *buffer, uint8_t places) {
}
}
}
void OLED::drawHex(uint32_t x, FontStyle fontStyle) {
// print number to hex
for (uint_fast8_t i = 0; i < 8; i++) {
uint16_t value = (x >> (4 * (7 - i))) & 0b1111;
drawChar(value + 2, fontStyle);
}
}
// maximum places is 5
void OLED::printNumber(uint16_t number, uint8_t places, FontStyle fontStyle, bool noLeaderZeros) {
char buffer[7] = {0};
@@ -624,3 +631,36 @@ void OLED::drawHeatSymbol(uint8_t state) {
}
bool OLED::isInitDone() { return initDone; }
bool OLED::getRotation() {
#ifdef OLED_FLIP
return !inLeftHandedMode;
#else
return inLeftHandedMode;
#endif
}
void OLED::setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}
void OLED::refresh() {
I2C_CLASS::Transmit(DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START + (OLED_WIDTH * 2));
// DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
// or we need to goto double buffering
}
void OLED::setDisplayState(OLED::DisplayState state) {
displayState = state;
screenBuffer[1] = (state == ON) ? 0xAF : 0xAE;
}
// Clears the buffer
void OLED::clearScreen() { memset(firstStripPtr, 0, OLED_WIDTH * 2); }
// Draws the battery level symbol
void OLED::drawBattery(uint8_t state) { drawSymbol(3 + (state > 10 ? 10 : state)); }
// Draws a checkbox
void OLED::drawCheckbox(bool state) { drawSymbol((state) ? 16 : 17); }
void OLED::drawImage(const uint8_t *buffer, uint8_t x, uint8_t width) { drawArea(x, 0, width, 16, buffer); }
int16_t OLED::getCursorX() { return cursor_x; }

View File

@@ -14,13 +14,6 @@
#include <BSP.h>
#include <stdbool.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "FreeRTOS.h"
#ifdef __cplusplus
}
#endif
#ifdef OLED_I2CBB
#include "I2CBB.hpp"
@@ -48,47 +41,32 @@ public:
static void initialize(); // Startup the I2C coms (brings screen out of reset etc)
static bool isInitDone();
// Draw the buffer out to the LCD using the DMA Channel
static void refresh() {
I2C_CLASS::Transmit(DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START + (OLED_WIDTH * 2));
// DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
// or we need to goto double buffering
}
static void refresh();
static void setDisplayState(DisplayState state) {
displayState = state;
screenBuffer[1] = (state == ON) ? 0xAF : 0xAE;
}
static void setDisplayState(DisplayState state);
static void setRotation(bool leftHanded); // Set the rotation for the screen
// Get the current rotation of the LCD
static bool getRotation() {
#ifdef OLED_FLIP
return !inLeftHandedMode;
#else
return inLeftHandedMode;
#endif
}
static bool getRotation();
static void setBrightness(uint8_t contrast);
static void setInverseDisplay(bool inverted);
static int16_t getCursorX() { return cursor_x; }
static int16_t getCursorX();
static void print(const char *string, FontStyle fontStyle); // Draw a string to the current location, with selected font
static void printWholeScreen(const char *string);
// Set the cursor location by pixels
static void setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}
static void setCursor(int16_t x, int16_t y);
// Draws an image to the buffer, at x offset from top to bottom (fixed height renders)
static void drawImage(const uint8_t *buffer, uint8_t x, uint8_t width) { drawArea(x, 0, width, 16, buffer); }
static void drawImage(const uint8_t *buffer, uint8_t x, uint8_t width);
// Draws a number at the current cursor location
static void printNumber(uint16_t number, uint8_t places, FontStyle fontStyle, bool noLeaderZeros = true);
// Clears the buffer
static void clearScreen() { memset(firstStripPtr, 0, OLED_WIDTH * 2); }
static void clearScreen();
// Draws the battery level symbol
static void drawBattery(uint8_t state) { drawSymbol(3 + (state > 10 ? 10 : state)); }
static void drawBattery(uint8_t state);
// Draws a checkbox
static void drawCheckbox(bool state) { drawSymbol((state) ? 16 : 17); }
static void drawCheckbox(bool state);
static void debugNumber(int32_t val, FontStyle fontStyle);
static void drawHex(uint32_t x, FontStyle fontStyle);
static void drawSymbol(uint8_t symbolID); // Used for drawing symbols of a predictable width
static void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr); // Draw an area, but y must be aligned on 0/8 offset
static void drawAreaSwapped(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr); // Draw an area, but y must be aligned on 0/8 offset
@@ -104,8 +82,8 @@ public:
private:
static void drawChar(uint16_t charCode, FontStyle fontStyle); // Draw a character to the current cursor location
static void setFramebuffer(uint8_t *buffer);
static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
static uint8_t * secondStripPtr; // Pointers to the strips
static uint8_t *firstStripPtr; // Pointers to the strips to allow for buffer having extra content
static uint8_t *secondStripPtr; // Pointers to the strips
static bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
static bool initDone;
static DisplayState displayState;

View File

@@ -1,4 +1,5 @@
#include "USBPD.h"
#include "Settings.h"
#include "configuration.h"
#if POW_PD

View File

@@ -0,0 +1,25 @@
if (LANG STREQUAL "")
message(FATAL_ERROR "You must specify a language")
endif()
add_custom_command(
OUTPUT "translation_${LANG}.cpp"
COMMAND
python3 ${CMAKE_CURRENT_SOURCE_DIR}/../../../Translations/make_translation.py -o translation_${LANG}.cpp ${LANG}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../../Translations/translation_${LANG}.json
VERBATIM)
set(sources
translation_${LANG}.cpp
# lang_multi.cpp
lang_single.cpp
)
add_library(languages ${sources})
target_link_libraries(languages PRIVATE drivers brieflz mainSource )

View File

@@ -0,0 +1,17 @@
set(sources
freertos.c
FreeRTOSHooks.c
settingsGUI.cpp
main.cpp
power.cpp
QC3.cpp
ScrollMessage.cpp
Settings.cpp
syscalls.c
Translation.cpp
)
add_library(mainSource ${sources})
target_include_directories(mainSource PUBLIC .)
target_link_libraries(mainSource PRIVATE brieflz BSP FreeRTOS drivers languages)

View File

@@ -8,14 +8,8 @@
#ifndef INC_QC3_H_
#define INC_QC3_H_
#include "stdint.h"
#ifdef __cplusplus
extern "C" {
#endif
void seekQC(int16_t Vx10, uint16_t divisor);
void startQC(uint16_t divisor); // Tries to negotiate QC for highest voltage, must be run after
bool hasQCNegotiated(); // Returns true if a QC negotiation worked (we are using QC)
#ifdef __cplusplus
}
#endif
#endif /* INC_QC3_H_ */

View File

@@ -1,6 +1,6 @@
#include "ScrollMessage.hpp"
#include "OLED.hpp"
#include "Settings.h"
#include "configuration.h"
/**

View File

@@ -3,9 +3,9 @@
#include "OLED.hpp"
#include "Setup.h"
extern uint32_t currentTempTargetDegC;
extern bool settingsWereReset;
extern bool usb_pd_available;
extern volatile uint32_t currentTempTargetDegC;
extern bool settingsWereReset;
extern bool usb_pd_available;
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -27,13 +27,13 @@ static void settings_displayQCInputV(void);
#if POW_PD
static void settings_displayPDNegTimeout(void);
#endif
#ifndef NO_SLEEP_MODE
static void settings_displaySensitivity(void);
static void settings_displayShutdownTime(void);
static bool settings_showSleepOptions(void);
#ifndef NO_SLEEP_MODE
static bool settings_setSleepTemp(void);
static void settings_displaySleepTemp(void);
static void settings_displaySleepTime(void);
static void settings_displayShutdownTime(void);
#endif
static bool settings_setTempF(void);
static void settings_displayTempF(void);
@@ -195,18 +195,18 @@ const menuitem solderingMenu[] = {
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE
};
const menuitem PowerSavingMenu[] = {
/*
* Motion Sensitivity
* -Sleep Temp
* -Sleep Time
* -Shutdown Time
*/
/*
* Motion Sensitivity
* -Sleep Temp
* -Sleep Time
* -Shutdown Time
*/
{SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, settings_displaySensitivity, nullptr, SettingsOptions::Sensitivity}, /* Motion Sensitivity*/
#ifndef NO_SLEEP_MODE
{SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, settings_displaySensitivity, nullptr, SettingsOptions::Sensitivity}, /* Motion Sensitivity*/
{SETTINGS_DESC(SettingsItemIndex::SleepTemperature), settings_setSleepTemp, settings_displaySleepTemp, settings_showSleepOptions, SettingsOptions::SettingsOptionsLength}, /*Sleep Temp*/
{SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, settings_displaySleepTime, settings_showSleepOptions, SettingsOptions::SleepTime}, /*Sleep Time*/
{SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, settings_displayShutdownTime, settings_showSleepOptions, SettingsOptions::ShutdownTime}, /*Shutdown Time*/
#endif
{SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, settings_displayShutdownTime, settings_showSleepOptions, SettingsOptions::ShutdownTime}, /*Shutdown Time*/
#ifdef HALL_SENSOR
{SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, settings_displayHallEffect, settings_showHallEffect, SettingsOptions::HallEffectSensitivity}, /* HallEffect Sensitivity*/
#endif
@@ -362,8 +362,6 @@ static void settings_displayPDNegTimeout(void) {
}
#endif
#ifndef NO_SLEEP_MODE
static void settings_displayShutdownTime(void) {
printShortDescription(SettingsItemIndex::ShutdownTimeout, 5);
if (getSettingValue(SettingsOptions::ShutdownTime) == 0) {
@@ -374,6 +372,14 @@ static void settings_displayShutdownTime(void) {
}
}
static void settings_displaySensitivity(void) {
printShortDescription(SettingsItemIndex::MotionSensitivity, 7);
OLED::printNumber(getSettingValue(SettingsOptions::Sensitivity), 1, FontStyle::LARGE, false);
}
static bool settings_showSleepOptions(void) { return getSettingValue(SettingsOptions::Sensitivity) > 0; }
#ifndef NO_SLEEP_MODE
static bool settings_setSleepTemp(void) {
// If in C, 10 deg, if in F 20 deg
uint16_t temp = getSettingValue(SettingsOptions::SleepTemp);
@@ -392,12 +398,6 @@ static bool settings_setSleepTemp(void) {
}
}
static void settings_displaySensitivity(void) {
printShortDescription(SettingsItemIndex::MotionSensitivity, 7);
OLED::printNumber(getSettingValue(SettingsOptions::Sensitivity), 1, FontStyle::LARGE, false);
}
static bool settings_showSleepOptions(void) { return getSettingValue(SettingsOptions::Sensitivity) > 0; }
static void settings_displaySleepTemp(void) {
printShortDescription(SettingsItemIndex::SleepTemperature, 5);
OLED::printNumber(getSettingValue(SettingsOptions::SleepTemp), 3, FontStyle::LARGE);

View File

@@ -0,0 +1,14 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(sources
GUIThread.cpp
MOVThread.cpp
PIDThread.cpp
POWThread.cpp
shared.cpp
)
add_library(threads ${sources})
target_include_directories(threads PUBLIC .)
target_link_libraries(threads PRIVATE mainSource drivers BSP FreeRTOS languages BSPImplementation )

View File

@@ -29,7 +29,7 @@ extern "C" {
#include "pd.h"
#endif
// File local variables
extern uint32_t currentTempTargetDegC;
extern TickType_t lastMovementTime;
extern bool heaterThermalRunaway;
extern osThreadId GUITaskHandle;
@@ -172,7 +172,7 @@ static void gui_drawBatteryIcon() {
}
static void gui_solderingTempAdjust() {
uint32_t lastChange = xTaskGetTickCount();
currentTempTargetDegC = 0;
currentTempTargetDegC = 0; // Turn off header while adjusting temp
uint32_t autoRepeatTimer = 0;
uint8_t autoRepeatAcceleration = 0;
bool waitForRelease = false;
@@ -350,28 +350,11 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
OLED::refresh();
GUIDelay();
#ifdef ACCEL_EXITS_ON_MOVEMENT
// If the accel works in reverse where movement will cause exiting the soldering mode
if (getSettingValue(SettingsOptions::Sensitivity)) {
if (lastMovementTime) {
if (lastMovementTime > TICKS_SECOND * 10) {
// If we have moved recently; in the last second
// Then exit soldering mode
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
currentTempTargetDegC = 0;
return 1;
}
}
}
}
#else
if (!shouldBeSleeping(autoStarted)) {
return 0;
}
#endif
if (shouldShutdown()) {
// shutdown
currentTempTargetDegC = 0;
@@ -511,12 +494,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
boostModeOn = false;
break;
case BUTTON_BOTH:
// exit
return;
break;
case BUTTON_B_LONG:
return; // exit on back long hold
break;
case BUTTON_F_LONG:
// if boost mode is enabled turn it on
if (getSettingValue(SettingsOptions::BoostTemp))
@@ -649,6 +628,31 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
}
#endif
#ifdef ACCEL_EXITS_ON_MOVEMENT
// If the accel works in reverse where movement will cause exiting the soldering mode
if (getSettingValue(SettingsOptions::Sensitivity)) {
if (lastMovementTime) {
if (lastMovementTime > TICKS_SECOND * 10) {
// If we have moved recently; in the last second
// Then exit soldering mode
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
currentTempTargetDegC = 0;
return;
}
}
}
}
#endif
#ifdef NO_SLEEP_MODE
// No sleep mode, but still want shutdown timeout
if (shouldShutdown()) {
// shutdown
currentTempTargetDegC = 0;
return; // we want to exit soldering mode
}
#endif
if (shouldBeSleeping()) {
if (gui_SolderingSleepingMode(false, false)) {
return; // If the function returns non-0 then exit
@@ -665,8 +669,6 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
// If we have tripped thermal runaway, turn off heater and show warning
if (heaterThermalRunaway) {
currentTempTargetDegC = 0; // heater control off
// TODO WARNING
warnUser(translatedString(Tr->WarningThermalRunaway), 10 * TICKS_SECOND);
heaterThermalRunaway = false;
return;
@@ -689,46 +691,34 @@ void showDebugMenu(void) {
case 0: // Just prints date
break;
case 1:
// High water mark for GUI
OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL);
break;
case 2:
// High water mark for the Movement task
OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5, FontStyle::SMALL);
break;
case 3:
// High water mark for the PID task
OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5, FontStyle::SMALL);
break;
case 4:
// system up time stamp
OLED::printNumber(xTaskGetTickCount() / TICKS_100MS, 5, FontStyle::SMALL);
break;
case 5:
case 2:
// Movement time stamp
OLED::printNumber(lastMovementTime / TICKS_100MS, 5, FontStyle::SMALL);
break;
case 6:
case 3:
// Raw Tip
{ OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 6, FontStyle::SMALL); }
break;
case 7:
case 4:
// Temp in C
OLED::printNumber(TipThermoModel::getTipInC(), 5, FontStyle::SMALL);
break;
case 8:
case 5:
// Handle Temp
OLED::printNumber(getHandleTemperature(0), 6, FontStyle::SMALL);
break;
case 9:
case 6:
// Voltage input
printVoltage();
break;
case 10:
case 7:
// Print ACC type
OLED::print(AccelTypeNames[(int)DetectedAccelerometerVersion], FontStyle::SMALL);
break;
case 11:
case 8:
// Power negotiation status
{
int sourceNumber = 0;
@@ -764,12 +754,32 @@ void showDebugMenu(void) {
OLED::print(PowerSourceNames[sourceNumber], FontStyle::SMALL);
}
break;
case 12:
case 9:
// Print device ID Numbers
{
uint64_t id = getDeviceID();
OLED::drawHex((uint32_t)(id >> 32), FontStyle::SMALL);
OLED::drawHex((uint32_t)(id & 0xFFFFFFFF), FontStyle::SMALL);
}
break;
case 10:
// Max deg C limit
OLED::printNumber(TipThermoModel::getTipMaxInC(), 3, FontStyle::SMALL);
break;
#ifdef HALL_SENSOR
case 11:
// High water mark for GUI
OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL);
break;
case 12:
// High water mark for the Movement task
OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5, FontStyle::SMALL);
break;
case 13:
// High water mark for the PID task
OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5, FontStyle::SMALL);
break;
#ifdef HALL_SENSOR
case 14:
// Print raw hall effect value if availabe, none if hall effect disabled.
{
int16_t hallEffectStrength = getRawHallEffect();
@@ -779,6 +789,7 @@ void showDebugMenu(void) {
}
break;
#endif
default:
break;
}
@@ -790,9 +801,9 @@ void showDebugMenu(void) {
else if (b == BUTTON_F_SHORT) {
screen++;
#ifdef HALL_SENSOR
screen = screen % 14;
screen = screen % 15;
#else
screen = screen % 13;
screen = screen % 14;
#endif
}
GUIDelay();

View File

@@ -17,7 +17,7 @@
static TickType_t powerPulseWaitUnit = 25 * TICKS_100MS; // 2.5 s
static TickType_t powerPulseDurationUnit = (5 * TICKS_100MS) / 2; // 250 ms
TaskHandle_t pidTaskNotification = NULL;
uint32_t currentTempTargetDegC = 0; // Current temperature target in C
volatile uint32_t currentTempTargetDegC = 0; // Current temperature target in C
int32_t powerSupplyWattageLimit = 0;
bool heaterThermalRunaway = false;
@@ -39,21 +39,26 @@ void startPIDTask(void const *argument __unused) {
pidTaskNotification = xTaskGetCurrentTaskHandle();
uint32_t PIDTempTarget = 0;
// Pre-seed the adc filters
for (int i = 0; i < 128; i++) {
osDelay(5);
for (int i = 0; i < 32; i++) {
ulTaskNotifyTake(pdTRUE, 5);
TipThermoModel::getTipInC(true);
getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 1);
}
while (preStartChecks() != 0) {
ulTaskNotifyTake(pdTRUE, 2000);
}
int32_t x10WattsOut = 0;
for (;;) {
x10WattsOut = 0;
// This is a call to block this thread until the ADC does its samples
if (ulTaskNotifyTake(pdTRUE, 2000)) {
if (ulTaskNotifyTake(pdTRUE, TICKS_SECOND * 2)) {
// Do the reading here to keep the temp calculations churning along
uint32_t currentTipTempInC = TipThermoModel::getTipInC(true);
PIDTempTarget = currentTempTargetDegC;
if (PIDTempTarget) {
if (PIDTempTarget > 0) {
// Cap the max set point to 450C
if (PIDTempTarget > (450)) {
// Maximum allowed output

View File

@@ -0,0 +1,4 @@
#include "FreeRTOS.h"
#include "main.hpp"
#include "task.h"
TaskHandle_t pidTaskNotification = NULL;

View File

@@ -0,0 +1,10 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(sources
brieflz.c
depack.c
)
add_library(brieflz ${sources})
target_include_directories(brieflz PUBLIC .)

View File

@@ -1,5 +1,5 @@
ifndef model
model:=TS100
model:=Pinecil
endif
ALL_MINIWARE_MODELS=TS100 TS80 TS80P
@@ -52,7 +52,7 @@ MINIWARE_INC_CMSIS_DEVICE = ./Core/BSP/Miniware/Vendor/CMSIS/Device/ST/STM32F1xx
MINIWARE_CMSIS_CORE_INC_DIR = ./Core/BSP/Miniware/Vendor/CMSIS/Include
MINIWARE_HAL_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
MINIWARE_HAL_LEGACY_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
MINIWARE_STARTUP_DIR = ./Startup
MINIWARE_STARTUP_DIR = ./Core/BSP/Miniware
MINIWARE_INC_DIR = ./Core/BSP/Miniware
MINIWARE_LD_FILE = ./Core/BSP/Miniware/stm32f103.ld
@@ -60,7 +60,7 @@ MHP30_INC_CMSIS_DEVICE = ./Core/BSP/MHP30/Vendor/CMSIS/Device/ST/STM32F1xx/Inclu
MHP30_CMSIS_CORE_INC_DIR = ./Core/BSP/MHP30/Vendor/CMSIS/Include
MHP30_HAL_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc
MHP30_HAL_LEGACY_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
MHP30_STARTUP_DIR = ./Startup
MHP30_STARTUP_DIR = ./Core/BSP/MHP30
MHP30_INC_DIR = ./Core/BSP/MHP30
MHP30_LD_FILE = ./Core/BSP/MHP30/stm32f103.ld
@@ -71,8 +71,8 @@ PINE_NMSIS_INC_DIR = ./Core/BSP/Pine64/Vendor/NMSIS/Core/Include
PINE_FREERTOS_PORT_INC_DIR = ./Core/BSP/Pine64/Vendor/OS/FreeRTOS/Source/portable/GCC
SOURCE_MIDDLEWARES_DIR = ./Middlewares
FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
FRTOS_CMIS_INC_DIR = ./Middlewares/FreeRTOS/Source/CMSIS_RTOS
FRTOS_INC_DIR = ./Middlewares/FreeRTOS/Source/include
DRIVER_INC_DIR =./Core/Drivers
BSP_INC_DIR = ./Core/BSP
THREADS_INC_DIR = ./Core/Threads
@@ -161,7 +161,7 @@ bootldr_size=0x0
CPUFLAGS= -march=rv32imac \
-mabi=ilp32 \
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles
DEV_LDFLAGS=-nostartfiles --specs=patch.specs
DEV_LDFLAGS=-nostartfiles
DEV_AFLAGS=
DEV_GLOBAL_DEFS= -DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
DEV_CFLAGS=
@@ -192,10 +192,10 @@ $(shell find $(DEVICE_BSP_DIR) -type f -name '*.cpp') \
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
# code optimisation ------------------------------------------------------------
OPTIM=-Os -flto -finline-small-functions -fshort-wchar -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common
# global defines ---------------------------------------------------------------
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
DEBUG=-g3
ifdef swd_enable

View File

@@ -0,0 +1 @@
add_subdirectory(FreeRTOS)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
set(sources
croutine.c
event_groups.c
list.c
queue.c
tasks.c
timers.c
CMSIS_RTOS/cmsis_os.c
)
add_library(FreeRTOS ${sources})
#Reqired to be able to grab the freertos config header
target_link_libraries(FreeRTOS PRIVATE BSP PUBLIC BSPImplementation)
target_include_directories(FreeRTOS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_RTOS)

Some files were not shown because too many files have changed in this diff Show More