-
Notifications
You must be signed in to change notification settings - Fork 111
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
feat: Add support for inverting reset and boot pins (ESF-177) #120
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,19 @@ This is the time for which the boot pin is asserted when doing a hard reset in m | |
|
||
Default: 50 | ||
|
||
* `SERIAL_FLASHER_RESET_INVERT` | ||
|
||
This inverts the output of the reset gpio pin. Useful if the hardware has inverting connection | ||
between the host and the target reset pin. Implemented only for UART interface. | ||
|
||
Default: n | ||
|
||
* `SERIAL_FLASHER_BOOT_INVERT` | ||
This inverts the output of the boot (IO0) gpio pin. Useful if the hardware has inverting connection | ||
between the host and the target boot pin. Implemented only for UART interface. | ||
|
||
Default: n | ||
|
||
Comment on lines
+68
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rewrite appropriately. |
||
Configuration can be passed to `cmake` via command line: | ||
|
||
``` | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -142,18 +142,18 @@ esp_loader_error_t loader_port_read(uint8_t *data, uint16_t size, uint32_t timeo | |||||
// assert reset pin for 50 milliseconds. | ||||||
void loader_port_enter_bootloader(void) | ||||||
{ | ||||||
gpio_set_level(s_gpio0_trigger_pin, 0); | ||||||
gpio_set_level(s_gpio0_trigger_pin, SERIAL_FLASHER_BOOT_INVERT ? 1 : 0); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. esp32_port.c refers to This same question goes for the other comments too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @shiona, this is due to the fact that KConfig options do not get simply passed as defines to the build in ESP-IDF. KConfig options are processed and then CMake variables are created from them, which have to be handled in the build system. These CMake variables will have the You can see that we have created a convenience macro for adding options which handles those differences and also the |
||||||
loader_port_reset_target(); | ||||||
loader_port_delay_ms(SERIAL_FLASHER_BOOT_HOLD_TIME_MS); | ||||||
gpio_set_level(s_gpio0_trigger_pin, 1); | ||||||
gpio_set_level(s_gpio0_trigger_pin, SERIAL_FLASHER_BOOT_INVERT ? 0 : 1); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
|
||||||
void loader_port_reset_target(void) | ||||||
{ | ||||||
gpio_set_level(s_reset_trigger_pin, 0); | ||||||
gpio_set_level(s_reset_trigger_pin, SERIAL_FLASHER_RESET_INVERT ? 1 : 0); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually believe the initial approach is more readable and future-proof, as well as being consistent with the rest of the ports. |
||||||
loader_port_delay_ms(SERIAL_FLASHER_RESET_HOLD_TIME_MS); | ||||||
gpio_set_level(s_reset_trigger_pin, 1); | ||||||
gpio_set_level(s_reset_trigger_pin, SERIAL_FLASHER_RESET_INVERT ? 0 : 1); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gpio_set_level(s_reset_trigger_pin, !CONFIG_SERIAL_FLASHER_RESET_ACTIVE_LEVEL); |
||||||
} | ||||||
|
||||||
|
||||||
|
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.
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.
I actually don't see a problem with the current naming, but this is fine as well.