|
| 1 | + |
| 2 | + |
| 3 | +### *Custom Boards* |
| 4 | +___________________ |
| 5 | + |
| 6 | + |
| 7 | +I added the ability to provide a path to a custom board. There are a few requirememnts for |
| 8 | +this to work properly. The best bet is to look at the files in the `custom_board_and_toml_examples/MY_CUSTOM_BOARD` |
| 9 | +folder to see what files are needed and to also get an idea of the kind of information that |
| 10 | +is in the files. |
| 11 | + |
| 12 | +***NOTE***: There are only 2 options that get used when supplying a custom board. The first one |
| 13 | + is the build target and the second is the `--custom-board-path` command. ALL others |
| 14 | + are ignored. The reason they are ignored is because you have the ability to set things |
| 15 | + in the files for the custom board. |
| 16 | + |
| 17 | + |
| 18 | +The path needs to point to the folder that holds the board specification files. Here is a list of required files. |
| 19 | + |
| 20 | +* `board.json`: This file outlines what the board is. At a minimum the file needs to contain the following. |
| 21 | + ``` |
| 22 | + { |
| 23 | + "mcu": "{MCU}" |
| 24 | + } |
| 25 | + ``` |
| 26 | + where `{MCU}` is one of the follwing: |
| 27 | + |
| 28 | + * esp32 |
| 29 | + * esp32s2 |
| 30 | + * esp32s3 |
| 31 | + * esp32c3 |
| 32 | + * esp32c6 |
| 33 | + |
| 34 | +* `sdkconfig.board`: This file contains all of the ESP-IDF specific config settings. If you don't know |
| 35 | + what needs to be set in here then please ask me for assistance. |
| 36 | +* `mpconfigboard.h`: MicroPython config settings. If you don't know what needs to be set in here then |
| 37 | + please ask me for assistance. |
| 38 | +* `mpconfigboard.cmake`: Build script. At a minimum the following should be in the build script. |
| 39 | + `{MCU}` is replaced with one of the options from the list of MCU's above. |
| 40 | + `{BOARD_CONATINING_FOLDER}` if the name of the folder these files are located in. |
| 41 | +``` |
| 42 | +set(IDF_TARGET {MCU}) |
| 43 | +
|
| 44 | +set(SDKCONFIG_DEFAULTS |
| 45 | + boards/sdkconfig.base |
| 46 | + ${SDKCONFIG_IDF_VERSION_SPECIFIC} |
| 47 | + boards/{BOARD_CONATINING_FOLDER}/sdkconfig.board |
| 48 | +) |
| 49 | +``` |
| 50 | + |
| 51 | +* `partition.csv`: This file dictates what the partitions are supposed to be on the ESP32. As for assistance |
| 52 | + If you do not know how to create one of these. |
| 53 | + |
| 54 | +***NOTE***: The `.toml` file in the custom board example is NOT a requirement. I do strongly suggest using it |
| 55 | + since it will tie everything together. You can specify all of the display and indev bits and pieces. |
| 56 | + see [TOML Example](#toml-example) for further information. |
| 57 | + |
| 58 | + |
| 59 | +### *TOML Example* |
| 60 | +__________________ |
| 61 | + |
| 62 | +Here is an example of what you would put inside of the `.toml` file. |
| 63 | +I will go over each section below. |
| 64 | + |
| 65 | + [MCU.esp32] |
| 66 | + BOARD = "ESP32_GENERIC_S3" |
| 67 | + BOARD_VARIANT = "SPIRAM_OCT" |
| 68 | + octal_flash = true |
| 69 | + flash_size = 16 |
| 70 | + enable_jtag_repl = 'n' |
| 71 | + enable_cdc_repl = 'n' |
| 72 | + enable_uart_repl = 'y' |
| 73 | + uart_repl_bitrate = 115200 |
| 74 | + |
| 75 | + [I80Bus.display_bus] |
| 76 | + data0 = 9 |
| 77 | + data1 = 46 |
| 78 | + data2 = 3 |
| 79 | + data3 = 8 |
| 80 | + data4 = 18 |
| 81 | + data5 = 17 |
| 82 | + data6 = 16 |
| 83 | + data7 = 15 |
| 84 | + dc = 0 |
| 85 | + wr = 47 |
| 86 | + cs = -1 |
| 87 | + freq = 20000000 |
| 88 | + |
| 89 | + [I2C.Bus.i2c_bus] |
| 90 | + host = 0 |
| 91 | + scl = 5 |
| 92 | + sda = 6 |
| 93 | + freq = 100000 |
| 94 | + |
| 95 | + [I2C.Device.indev_device] |
| 96 | + bus = "i2c_bus" |
| 97 | + dev_id = "ft6x36.I2C_ADDR" |
| 98 | + reg_bits = "ft6x36.BITS" |
| 99 | + |
| 100 | + [ST7796.display] |
| 101 | + data_bus = "display_bus" |
| 102 | + display_width = 320 |
| 103 | + display_height = 480 |
| 104 | + backlight_pin = 45 |
| 105 | + color_byte_order = "st7789.BYTE_ORDER_BGR" |
| 106 | + color_space = "lv.COLOR_FORMAT.RGB565" |
| 107 | + rgb565_byte_swap = true |
| 108 | + |
| 109 | + [ST7796.display.init] |
| 110 | + params = [] |
| 111 | + |
| 112 | + [FT6x36.indev] |
| 113 | + device = "indev_device" |
| 114 | + |
| 115 | + [display.set_color_inversion] |
| 116 | + params = [true] |
| 117 | + |
| 118 | + [display.set_rotation] |
| 119 | + params = ["lv.DISPLAY_ROTATION._90"] |
| 120 | + |
| 121 | + [display.set_backlight] |
| 122 | + params = [100] |
| 123 | + |
| 124 | + [task_handler.TaskHandler] |
| 125 | + params=[] |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +* `[MCU.{target}]`: `{target}` is the build target you want to use. In the example above we are using `esp32` |
| 130 | + The parameters that immediatly follow are almost the same as what you would use for build commands |
| 131 | + when entering them from the command line. There are a few rules for how those commands get enetered. |
| 132 | + |
| 133 | + * options that star with `--` need to have the `--` removed and all `-`'s in the name need to be change to `_`. |
| 134 | + * options are cas esensitive |
| 135 | + * options that take a string value need to be wrapped in double quotes (`"value"`) |
| 136 | + * options that do not take any value *MUST* have the value set to `true` |
| 137 | + * options like `DISPLAY` and `INDEV` which are able to be repeated cannot be repeated (yet). That means you can onmly |
| 138 | + supply a single display or indev. You only need to supply the `DISPLAY` and `INDEV` if you are not wanting to automatically |
| 139 | + build the startup script. |
| 140 | + |
| 141 | + |
| 142 | + [MCU.esp32] |
| 143 | + BOARD = "ESP32_GENERIC_S3" |
| 144 | + BOARD_VARIANT = "SPIRAM_OCT" |
| 145 | + octal_flash = true |
| 146 | + flash_size = 16 |
| 147 | + enable_jtag_repl = 'n' |
| 148 | + enable_cdc_repl = 'n' |
| 149 | + enable_uart_repl = 'y' |
| 150 | + uart_repl_bitrate = 115200 |
| 151 | + |
| 152 | +* `[{display bus}.{variable name}]`: `[I80Bus.display_bus]`, That heading section gets turnmed into `display_bus = lcd_bus.I80Bus(...)`. |
| 153 | + The variable name you will use when passing the display bus instance to the display driver. I will |
| 154 | + go into that more later on. The list of options below this heading are the parameters that get passed. |
| 155 | + These options MUST match the names of the parameters for the class being used. |
| 156 | +* `[I2C.Bus.{variable name}]` and `[I2C.Device.{variable_name}]` |
0 commit comments