|
2 | 2 |
|
3 | 3 | ## Build SmallBASIC |
4 | 4 |
|
5 | | -Download and build SmallBASIC as described [here](https://github.com/smallbasic/SmallBASIC). |
| 5 | +Teensy 4.0 and Teensy 4.1 are supported. Both using the same processor and running at the same speed. |
| 6 | +But Teensy 4.1 offers more features than Teensy 4.0. The standard build is for Teensy 4.1. |
6 | 7 |
|
7 | | -## Configure Tennsy version |
| 8 | +Download and build SmallBASIC as described [here](https://github.com/smallbasic/SmallBASIC). |
8 | 9 |
|
9 | | -Tennsy 4 and Tennsy 4.1 are supported. Both using the same processor and running at the same speed. |
10 | | -But Tennsy 4.1 offers more features than Tennsy 4. Currently, you have to configure two files depending |
11 | | -which MCU you use. |
| 10 | +## Build Teensy firmware |
12 | 11 |
|
13 | | -1. `src/platform/teensy/Makefile.am` |
14 | | - `--mcu=TENNSY4` or `--mcu=TENNSY41` |
| 12 | +### Initial setup |
15 | 13 |
|
16 | | - ``` |
17 | | - install: build/smallbasic.elf |
18 | | - @build/modules/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY41 -w -v -s build/smallbasic.hex && \ |
19 | | - sleep 1 && \ |
20 | | - lsusb | grep -i teensy |
21 | | - ``` |
| 14 | +Install the following packages (Manjaro (arch)): |
22 | 15 |
|
23 | | -2. `src/platform/teensy/CMakeLists.txt` |
24 | | - Comment/Uncomment settings for Teensy 4 / Tennsy 4.1 |
| 16 | +``` |
| 17 | +$ sudo pacman -S arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib libusb-compat |
| 18 | +``` |
25 | 19 |
|
26 | | - ``` |
27 | | - # settings for teensy 4.0 |
28 | | - #set(MODULES ${CMAKE_CURRENT_SOURCE_DIR}/build/modules) |
29 | | - #set(TEENSY_SRC ${MODULES}/cores/teensy4) |
30 | | - #set(MCU "IMXRT1062") |
31 | | - #set(MCU_LD ${TEENSY_SRC}/imxrt1062.ld) |
32 | | - #set(MCU_DEF "ARDUINO_TEENSY4") |
33 | | - #set(CPU_OPTIONS "-mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb") |
| 20 | +Add udev rules for serial USB: |
34 | 21 |
|
35 | | - # settings for teensy 4.1 |
36 | | - set(MODULES ${CMAKE_CURRENT_SOURCE_DIR}/build/modules) |
37 | | - set(TEENSY_SRC ${MODULES}/cores/teensy4) |
38 | | - set(MCU "IMXRT1062") |
39 | | - set(MCU_LD ${TEENSY_SRC}/imxrt1062_t41.ld) |
40 | | - set(MCU_DEF "ARDUINO_TEENSY41") |
41 | | - set(CPU_OPTIONS "-mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb") |
42 | | - ``` |
| 22 | +``` |
| 23 | +curl -sLO https://www.pjrc.com/teensy/00-teensy.rules |
| 24 | +sudo cp 00-teensy.rules /etc/udev/rules.d/ |
| 25 | +``` |
43 | 26 |
|
44 | | -## Build firmware in Manjaro (arch) |
| 27 | +Download and build core libraries: |
45 | 28 |
|
46 | 29 | ``` |
47 | | -$ sudo pacman -S arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib libusb-compat |
48 | 30 | $ ./configure --enable-teensy |
49 | 31 | $ cd src/platform/teensy |
50 | 32 | $ ./setup.sh |
| 33 | +``` |
| 34 | + |
| 35 | +### Build firmware for Teensy 4.1 |
| 36 | + |
| 37 | +The following instructions will build and install the firmware for Teensy 4.1. |
| 38 | + |
| 39 | +``` |
51 | 40 | $ make |
52 | 41 | ``` |
53 | 42 |
|
54 | 43 | > If setup.sh displays an error massage that cmake minimum version is not set, |
55 | 44 | > open `build/modules/CMSIS-DSP/CMakeLists.txt` |
56 | 45 | > and add in the beginning of the file `cmake_minimum_required(VERSION 4.1)` |
57 | 46 |
|
58 | | -## Upload the firmware |
| 47 | +Upload firmware: |
59 | 48 |
|
60 | 49 | ``` |
61 | 50 | make install |
|
67 | 56 | build/modules/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY41 -w -v -s build/smallbasic.hex |
68 | 57 | ``` |
69 | 58 |
|
| 59 | +### Build firmware for Tennsy 4.0 |
| 60 | + |
| 61 | +If you want to build the firmware for Tennsy 4.0, you have to run the following commands after |
| 62 | +initial setup: |
| 63 | + |
| 64 | +``` |
| 65 | +cd build |
| 66 | +cmake .. -DTEENSY40=ON |
| 67 | +``` |
| 68 | + |
| 69 | +and run `./configure --enable-teensy` again. Next you can build the firmware: |
| 70 | + |
| 71 | +``` |
| 72 | +$ make |
| 73 | +``` |
| 74 | + |
| 75 | +> If setup.sh displays an error massage that cmake minimum version is not set, |
| 76 | +> open `build/modules/CMSIS-DSP/CMakeLists.txt` |
| 77 | +> and add in the beginning of the file `cmake_minimum_required(VERSION 4.1)` |
| 78 | +
|
| 79 | +Upload firmware: |
| 80 | + |
| 81 | +``` |
| 82 | +make install40 |
| 83 | +``` |
| 84 | + |
| 85 | +or |
| 86 | + |
| 87 | +``` |
| 88 | +build/modules/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY40 -w -v -s build/smallbasic.hex |
| 89 | +``` |
| 90 | + |
70 | 91 | # Run your SMALLBASIC program |
71 | 92 |
|
72 | 93 | SMALLBASIC for Teensy offers three ways to upload and run a program. |
@@ -100,3 +121,13 @@ called, the program is terminated and the next section in the above list is perf |
100 | 121 | The `PRINT` command can be used to print to the USB-serial port. To access the output, connect to the serial |
101 | 122 | port using, i.e. `PUTTY` or any other serial-port monitor / terminal. Using Linux, the easiest way is to run |
102 | 123 | `cat /dev/ttyACM0` |
| 124 | + |
| 125 | +# Debugging the Teensy crash screen |
| 126 | + |
| 127 | +To find the line that failed (but no stack) run: |
| 128 | + |
| 129 | +``` |
| 130 | +arm-none-eabi-addr2line -e smallbasic.elf ADDRESS |
| 131 | +``` |
| 132 | + |
| 133 | +Where `ADDRESS` is the address shown in the crash screen, for example `0x17D04` |
0 commit comments