-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desktop support (Linux / Windows / Mac) (ESF-122) #102
Open
electromuis
wants to merge
4
commits into
espressif:master
Choose a base branch
from
electromuis:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1f6ca72
Working on desktop support
electromuis 947301c
Merge branch 'master' of https://github.com/espressif/esp-serial-flasher
electromuis 98d215b
Serial port config update. Firmware flash working
electromuis 4b650f8
Fixed timing bug. Added PR feedback
electromuis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
cmake_minimum_required(VERSION 3.5) | ||
project(esp-serial-flasher) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../submodules) | ||
find_package(WjwwoodSerial REQUIRED) | ||
|
||
set(ESPSERIAL_PATH ${CMAKE_CURRENT_LIST_DIR}/../../) | ||
|
||
# LIB esp_serial | ||
|
||
include(${ESPSERIAL_PATH}examples/common/bin2array.cmake) | ||
create_resources(${ESPSERIAL_PATH}examples/binaries/Hello-world ${CMAKE_BINARY_DIR}/binaries_1.c) | ||
set_property(SOURCE ${CMAKE_BINARY_DIR}/binaries_1.c PROPERTY GENERATED 1) | ||
create_resources(${ESPSERIAL_PATH}examples/binaries/RAM_APP ${CMAKE_BINARY_DIR}/binaries_2.c) | ||
set_property(SOURCE ${CMAKE_BINARY_DIR}/binaries_2.c PROPERTY GENERATED 1) | ||
|
||
|
||
add_library(esp_serial | ||
${ESPSERIAL_PATH}port/wjwwood_serial_port.cpp | ||
${ESPSERIAL_PATH}src/esp_loader.c | ||
${ESPSERIAL_PATH}src/esp_targets.c | ||
${ESPSERIAL_PATH}src/md5_hash.c | ||
${ESPSERIAL_PATH}src/slip.c | ||
${ESPSERIAL_PATH}src/protocol_uart.c | ||
${ESPSERIAL_PATH}src/protocol_common.c | ||
${CMAKE_BINARY_DIR}/binaries_1.c | ||
${CMAKE_BINARY_DIR}/binaries_2.c | ||
${ESPSERIAL_PATH}examples/common/example_common.c | ||
) | ||
|
||
target_include_directories(esp_serial PUBLIC | ||
${ESPSERIAL_PATH}include | ||
${ESPSERIAL_PATH}port | ||
${ESPSERIAL_PATH}examples/common | ||
) | ||
|
||
target_include_directories(esp_serial PRIVATE | ||
${ESPSERIAL_PATH}private_include | ||
) | ||
|
||
target_compile_definitions(esp_serial PUBLIC | ||
-DSERIAL_FLASHER_INTERFACE_USB | ||
-DMD5_ENABLED | ||
-DSERIAL_FLASHER_WRITE_BLOCK_RETRIES=4 | ||
-DSERIAL_FLASHER_DEBUG_TRACE | ||
) | ||
|
||
target_link_libraries(esp_serial PUBLIC wjwwood_serial) | ||
|
||
# EXECUTABLE desktop_esp32_example | ||
|
||
add_executable(desktop_esp32_example | ||
main/main.cpp | ||
) | ||
|
||
target_link_libraries(desktop_esp32_example PRIVATE | ||
esp_serial | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* Flash multiple partitions example | ||
|
||
This example code is in the Public Domain (or CC0 licensed, at your option.) | ||
|
||
Unless required by applicable law or agreed to in writing, this | ||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
CONDITIONS OF ANY KIND, either express or implied. | ||
*/ | ||
|
||
#include "stdio.h" | ||
#include <string.h> | ||
|
||
#include "wjwwood_serial_port.h" | ||
#include "esp_loader.h" | ||
#include "esp_loader_io.h" | ||
extern "C" { | ||
#include "example_common.h" | ||
|
||
} | ||
|
||
#include "serial/serial.h" | ||
|
||
#define HIGHER_BAUDRATE 230400 | ||
|
||
int main(int argv, char **argc) | ||
{ | ||
if(argv < 2) { | ||
printf("Usage: %s <port>\n", argc[0]); | ||
return 1; | ||
} | ||
|
||
example_binaries_t bin; | ||
|
||
loader_wjwwood_serial_config_t config; | ||
config.portName = argc[1]; | ||
//config.portName = "COM4"; | ||
config.baudrate = 115200; | ||
config.timeout = 600; | ||
|
||
if (loader_port_wjwwood_serial_init((const loader_wjwwood_serial_config_t*)&config) != ESP_LOADER_SUCCESS) { | ||
printf("Serial initialization failed.\n"); | ||
return -1; | ||
} | ||
|
||
printf("Connecting...\n"); | ||
if (connect_to_target(HIGHER_BAUDRATE) == ESP_LOADER_SUCCESS) { | ||
|
||
get_example_binaries(esp_loader_get_target(), &bin); | ||
|
||
printf("Loading bootloader...\n"); | ||
flash_binary(bin.boot.data, bin.boot.size, bin.boot.addr); | ||
printf("Loading partition table...\n"); | ||
flash_binary(bin.part.data, bin.part.size, bin.part.addr); | ||
printf("Loading app...\n"); | ||
flash_binary(bin.app.data, bin.app.size, bin.app.addr); | ||
printf("Done!\n"); | ||
loader_port_wjwwood_serial_deinit(); | ||
} else { | ||
printf("Connect failed\n"); | ||
loader_port_wjwwood_serial_deinit(); | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's better to be upfront here. I would preffer something like: