Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

.*/
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ high-speed either.

## Building

1. Install [esp-open-sdk](https://github.com/pfalcon/esp-open-sdk)
1. `sudo apt install esptool`
1. Compile and flash

```
ESP_OPEN_SDK=/opt/esp-open-sdk
export XTENSA_TOOLS_ROOT=$ESP_OPEN_SDK/xtensa-lx106-elf/bin SDK_BASE=$ESP_OPEN_SDK/sdk flash
make flash
```
- Use [Platformio](https://docs.platformio.org/en/stable/integration/ide/vscode.html) to easily build and flash ESP8266 from the VScode.

- Alternatively,
1. Install [esp-open-sdk](https://github.com/pfalcon/esp-open-sdk)
1. `sudo apt install esptool`
1. Compile and flash:

```
ESP_OPEN_SDK=/opt/esp-open-sdk
export XTENSA_TOOLS_ROOT=$ESP_OPEN_SDK/xtensa-lx106-elf/bin SDK_BASE=$ESP_OPEN_SDK/sdk flash
make flash
```

### Using a precompiled binary

Expand Down
16 changes: 16 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp-stlink]
platform = espressif8266
board = d1_mini
framework = esp8266-nonos-sdk
build_flags = -I src/include
monitor_speed = 921600
42 changes: 41 additions & 1 deletion src/user/user_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,53 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "user_interface.h"

#include "driver/swim.h"
#include "driver/uart.h"
#include "serial.h"

uint32 ICACHE_FLASH_ATTR
user_rf_cal_sector_set(void) {
enum flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;

switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
rf_cal_sec = 128 - 5;
break;

case FLASH_SIZE_8M_MAP_512_512:
rf_cal_sec = 256 - 5;
break;

case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal_sec = 512 - 5;
break;

case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
rf_cal_sec = 1024 - 5;
break;

case FLASH_SIZE_64M_MAP_1024_1024:
rf_cal_sec = 2048 - 5;
break;
case FLASH_SIZE_128M_MAP_1024_1024:
rf_cal_sec = 4096 - 5;
break;
default:
rf_cal_sec = 0;
break;
}
return rf_cal_sec;
}

void user_init(void) {
swim_init();
uart_init(BIT_RATE_921600, BIT_RATE_921600);
uart0_sendStr("ESP-STLINK\r\n");
uart0_sendStr("\r\nESP-STLINK\r\n");
serial_init();
}