File tree Expand file tree Collapse file tree 9 files changed +30
-14
lines changed
Expand file tree Collapse file tree 9 files changed +30
-14
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ jobs:
103103 run : timeout 10 bash espflash/tests/scripts/board-info.sh
104104
105105 - name : flash test
106- run : timeout 60 bash espflash/tests/scripts/flash.sh ${{ matrix.board.mcu }}
106+ run : timeout 80 bash espflash/tests/scripts/flash.sh ${{ matrix.board.mcu }}
107107
108108 - name : monitor test
109109 run : timeout 10 bash espflash/tests/scripts/monitor.sh
@@ -116,7 +116,7 @@ jobs:
116116 timeout 90 bash espflash/tests/scripts/save-image_write-bin.sh ${{ matrix.board.mcu }}
117117
118118 - name : erase-region test
119- run : timeout 15 bash espflash/tests/scripts/erase-region.sh
119+ run : timeout 30 bash espflash/tests/scripts/erase-region.sh
120120
121121 - name : hold-in-reset test
122122 run : timeout 10 bash espflash/tests/scripts/hold-in-reset.sh
Original file line number Diff line number Diff line change @@ -50,10 +50,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5050- Updated bootloaders with ` release/v5.4 ` ones from IDF (#857 )
5151- Refactor image formatting to allow supporting more image formats in a backward compatible way (#877 )
5252- Avoid having ESP-IDF format assumptions in the codebase (#877 )
53- - Automatically migrate ` espflash@3 ` configuration files to the new format (#883 )
54- - ` Flasher ` now takes the ` Connection ` in new, instead of constructing the connection inside ` Flasher::connect ` (#882 )
53+ - ` Flasher ` now takes the ` Connection ` in new, instead of constructing the connection inside ` Flasher::connect ` (#882 , #885 )
5554- ` detect_chip ` has moved to the ` Connection ` struct (#882 )
5655- ` Flasher::into_serial ` has been replaced by ` Flasher::into_connection ` (#882 )
56+ - Automatically migrate ` espflash@3 ` configuration files to the new format (#883 )
5757
5858### Fixed
5959
Original file line number Diff line number Diff line change @@ -453,6 +453,7 @@ pub fn connect(
453453 !no_verify,
454454 !no_skip,
455455 args. chip ,
456+ args. baud . or ( config. project_config . baudrate ) ,
456457 ) ?)
457458}
458459
Original file line number Diff line number Diff line change @@ -398,9 +398,9 @@ impl Connection {
398398 Ok ( ( ) )
399399 }
400400
401- /// Get the current baud rate of the serial port.
402- pub fn baud ( & self ) -> u32 {
403- self . baud
401+ // Get the current baud rate of the serial port.
402+ pub fn baud ( & self ) -> Result < u32 , Error > {
403+ Ok ( self . serial . baud_rate ( ) ? )
404404 }
405405
406406 /// Run a command with a timeout defined by the command type.
Original file line number Diff line number Diff line change @@ -648,6 +648,7 @@ impl Flasher {
648648 verify : bool ,
649649 skip : bool ,
650650 chip : Option < Chip > ,
651+ baud : Option < u32 > ,
651652 ) -> Result < Self , Error > {
652653 // The connection should already be established with the device using the
653654 // default baud rate of 115,200 and timeout of 3 seconds.
@@ -706,9 +707,11 @@ impl Flasher {
706707
707708 // Now that we have established a connection and detected the chip and flash
708709 // size, we can set the baud rate of the connection to the configured value.
709- if flasher. connection . baud ( ) > 115_200 {
710- warn ! ( "Setting baud rate higher than 115,200 can cause issues" ) ;
711- flasher. change_baud ( flasher. connection . baud ( ) ) ?;
710+ if let Some ( baud) = baud {
711+ if baud > 115_200 {
712+ warn ! ( "Setting baud rate higher than 115,200 can cause issues" ) ;
713+ flasher. change_baud ( baud) ?;
714+ }
712715 }
713716
714717 Ok ( flasher)
@@ -1132,7 +1135,7 @@ impl Flasher {
11321135 debug ! ( "Change baud to: {}" , baud) ;
11331136
11341137 let prior_baud = match self . use_stub {
1135- true => self . connection . baud ( ) ,
1138+ true => self . connection . baud ( ) ? ,
11361139 false => 0 ,
11371140 } ;
11381141
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ impl Target for Esp32 {
149149 #[ cfg( feature = "serialport" ) ]
150150 fn crystal_freq ( & self , connection : & mut Connection ) -> Result < XtalFrequency , Error > {
151151 let uart_div = connection. read_reg ( UART_CLKDIV_REG ) ? & UART_CLKDIV_MASK ;
152- let est_xtal = ( connection. baud ( ) * uart_div) / 1_000_000 / XTAL_CLK_DIVIDER ;
152+ let est_xtal = ( connection. baud ( ) ? * uart_div) / 1_000_000 / XTAL_CLK_DIVIDER ;
153153 let norm_xtal = if est_xtal > 33 {
154154 XtalFrequency :: _40Mhz
155155 } else {
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ impl Target for Esp32c2 {
7676 #[ cfg( feature = "serialport" ) ]
7777 fn crystal_freq ( & self , connection : & mut Connection ) -> Result < XtalFrequency , Error > {
7878 let uart_div = connection. read_reg ( UART_CLKDIV_REG ) ? & UART_CLKDIV_MASK ;
79- let est_xtal = ( connection. baud ( ) * uart_div) / 1_000_000 / XTAL_CLK_DIVIDER ;
79+ let est_xtal = ( connection. baud ( ) ? * uart_div) / 1_000_000 / XTAL_CLK_DIVIDER ;
8080 let norm_xtal = if est_xtal > 33 {
8181 XtalFrequency :: _40Mhz
8282 } else {
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ impl Target for Esp32c5 {
7878 #[ cfg( feature = "serialport" ) ]
7979 fn crystal_freq ( & self , connection : & mut Connection ) -> Result < XtalFrequency , Error > {
8080 let uart_div = connection. read_reg ( UART_CLKDIV_REG ) ? & UART_CLKDIV_MASK ;
81- let est_xtal = ( connection. baud ( ) * uart_div) / 1_000_000 / XTAL_CLK_DIVIDER ;
81+ let est_xtal = ( connection. baud ( ) ? * uart_div) / 1_000_000 / XTAL_CLK_DIVIDER ;
8282 let norm_xtal = if est_xtal > 45 {
8383 XtalFrequency :: _48Mhz
8484 } else {
Original file line number Diff line number Diff line change @@ -53,3 +53,15 @@ if ! echo "$result" | grep -q "Hello world!"; then
5353 echo " Monitoring failed!"
5454 exit 1
5555fi
56+
57+ # Test with a higher baud rate
58+ result=$( timeout 15s espflash flash --no-skip --monitor --non-interactive --baud 921600 $app 2>&1 | tr -d ' \0' )
59+ echo " $result "
60+ if [[ ! $result =~ " Flashing has completed!" ]]; then
61+ echo " Flashing failed!"
62+ exit 1
63+ fi
64+ if ! echo " $result " | grep -q " Hello world!" ; then
65+ echo " Monitoring failed!"
66+ exit 1
67+ fi
You can’t perform that action at this time.
0 commit comments