-
Notifications
You must be signed in to change notification settings - Fork 0
pr: can flash using bus pirate #6
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
Open
JohnAZoidberg
wants to merge
7
commits into
main
Choose a base branch
from
pr_buspirate_flash
base: main
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
7 commits
Select commit
Hold shift + click to select a range
3d55f10
pr: can flash using bus pirate
kiram9 506e533
Update scripts/flash_ec_buspirate.sh
JohnAZoidberg dbc99be
Update scripts/flash_ec_buspirate.sh
JohnAZoidberg 50f03fe
Update scripts/flash_ec_buspirate.sh
JohnAZoidberg 69477b8
Update scripts/flash_ec_buspirate.sh
JohnAZoidberg f794dfa
Update scripts/flash_ec_buspirate.sh
JohnAZoidberg e985359
Update scripts/flash_ec_buspirate.sh
JohnAZoidberg 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 hidden or 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,85 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Wiring: | ||
| # | JECDB | BusPirate 5 | | ||
| # | 1 EC_DEBUG_VCC | VOUT/VREF | | ||
| # | 2 UART_0_CRXD_DTXD | | | ||
| # | 3 JTAG_TMS | | | ||
| # | 4 JTAG_CLK | | | ||
| # | 5 JTAG_DTO | | | ||
| # | 6 EC_UART0_TX | IO5 | | ||
| # | 7 EC_UART0_RX | IO4 | | ||
| # | 8 UART_0_CTXD_DRXD | | | ||
| # | 9 nRESETI_R | IO2 | | ||
| # | 10 GND | GND | | ||
|
|
||
|
|
||
| DEVICE=${DEVICE:-"/dev/serial/by-id/usb-Bus_Pirate_Bus_Pirate_5"} | ||
| CTRLUART=(${DEVICE}*-if00) | ||
| FLASHUART=$(basename $(readlink ${DEVICE}*-if00)) | ||
|
|
||
| if [ $# -eq 0 ]; then | ||
| #no argument, try default locations | ||
| search_paths=("${HOME}/software/ec-lotus/src/platform/ec/build/zephyr/azalea/output"\ | ||
| "${HOME}/chromiumos/src/platform/ec/build/zephyr/azalea/output") | ||
|
|
||
| for search in ${search_paths[@]} | ||
| do | ||
| if [ -d $search ] | ||
| then | ||
| echo "${search} exists" | ||
| FLASH_SRC="${search}/ec.bin" | ||
| MONITOR="${search}/npcx_monitor.bin" | ||
| fi | ||
| done | ||
| else | ||
| #allow specifying a file as argument | ||
| FLASH_SRC="$1/ec.bin" | ||
| MONITOR="$1/npcx_monitor.bin" | ||
| fi | ||
| echo "USING ${FLASH_SRC} to flash EC" | ||
|
|
||
| #clear any invalid commands from uart buffer | ||
| echo -e "n\r\n" > ${CTRLUART} | ||
| # Put EC into reset by pulling nRESETI_R (pin 2 on buspirate) low | ||
| echo -e "\r\na 2\r\n" > ${CTRLUART} | ||
| #read INPUT < ${CTRLUART} | ||
| sleep 1 | ||
|
|
||
| # Enable BusPirate's 10k internal pulldown on UART RX wired to IO6 | ||
| # This switches the Nuvoton EC's UART from console mode into UUT update mode | ||
| echo -e "\r\na 6\r\n" > ${CTRLUART} | ||
| sleep 1 | ||
|
|
||
| # Take out of reset, set pin 2 (connected to nRESETI_R) as a pullup input on the buspirate | ||
| echo -e "\r\n@ 2\r\n" > ${CTRLUART} | ||
| sleep 1 | ||
|
|
||
| # Bridge UART via the BusPirate | ||
| # This turns the current UART consle to the bus pirate into a bridge to the EC | ||
| # After we're done, to exit, you have press the buspirate button | ||
| echo -e "\r\nbridge\r\n" > ${CTRLUART} | ||
|
|
||
| sleep 1 | ||
|
|
||
| #### DO FLASH | ||
| echo "Using NUVOTON Tool ./uartupdatetool" | ||
| ./uartupdatetool --port ${FLASHUART} --opr wr --addr 0x200c3020 --file ${MONITOR} | ||
| ./uartupdatetool --port ${FLASHUART} --opr wr --auto --addr 0x0000 --file ${FLASH_SRC} | ||
|
|
||
| read -p "Press button on buspirate" userinput | ||
|
|
||
| #### TAKE OUT OF RESET | ||
|
|
||
| #put ec into reset | ||
| echo -e "\r\na 2\r\n" > ${CTRLUART} | ||
| #read INPUT < ${CTRLUART} | ||
| sleep 1 | ||
|
|
||
| # Enable BusPirate's 10k internal pulldown on UART RX wired to IO6 | ||
| echo -e "\r\n@ 6\r\n" > ${CTRLUART} | ||
| sleep 1 | ||
|
|
||
|
|
||
| # take out of reset | ||
| echo -e "\r\n@ 2\r\n" > ${CTRLUART} | ||
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.
Uh oh!
There was an error while loading. Please reload this page.