@@ -594,36 +594,8 @@ impl HubrisFlashMap {
594594 }
595595}
596596
597- //
598- // This is the Hubris definition
599- //
600- #[ derive( Debug , Deserialize ) ]
601- pub enum FlashProgram {
602- PyOcd ( Vec < FlashArgument > ) ,
603- OpenOcd ( FlashProgramConfig ) ,
604- }
605-
606- #[ derive( Debug , Deserialize ) ]
607- pub enum FlashProgramConfig {
608- Path ( Vec < String > ) ,
609- Payload ( String ) ,
610- }
611-
612- #[ derive( Debug , Deserialize ) ]
613- pub enum FlashArgument {
614- Direct ( String ) ,
615- Payload ,
616- FormattedPayload ( String , String ) ,
617- Config ,
618- }
619-
620597#[ derive( Debug , Deserialize ) ]
621598pub struct HubrisFlashMeta {
622- /// Legacy flash program. Not included in new archives.
623- pub program : Option < FlashProgram > ,
624- /// Arguments for legacy flash program, or empty if not used.
625- #[ serde( default ) ]
626- pub args : Vec < FlashArgument > ,
627599 /// Chip name used by probe-rs.
628600 pub chip : Option < String > ,
629601}
@@ -1663,70 +1635,7 @@ impl HubrisArchive {
16631635 // This is incredibly ugly! It also gives us backwards compatibility!
16641636 let chip: Option < String > = match config. chip {
16651637 Some ( ref chip) => Some ( chip. to_string ( ) ) ,
1666- None => match & config. program {
1667- Some ( FlashProgram :: PyOcd ( args) ) => {
1668- let s69 = regex:: Regex :: new ( r"lpc55s69" ) . unwrap ( ) ;
1669- let s28 = regex:: Regex :: new ( r"lpc55s28" ) . unwrap ( ) ;
1670- let mut c: Option < String > = None ;
1671- for arg in args {
1672- c = match arg {
1673- FlashArgument :: Direct ( s) => {
1674- if s69. is_match ( s) {
1675- Some ( "LPC55S69JBD100" . to_string ( ) )
1676- } else if s28. is_match ( s) {
1677- Some ( "LPC55S28JBD64" . to_string ( ) )
1678- } else {
1679- None
1680- }
1681- }
1682- _ => None ,
1683- } ;
1684- if c. is_some ( ) {
1685- break ;
1686- }
1687- }
1688- c
1689- }
1690- Some ( FlashProgram :: OpenOcd ( a) ) => match a {
1691- FlashProgramConfig :: Payload ( d) => {
1692- let h7 =
1693- regex:: Regex :: new ( r"find target/stm32h7" ) . unwrap ( ) ;
1694- let f3 =
1695- regex:: Regex :: new ( r"find target/stm32f3" ) . unwrap ( ) ;
1696- let f4 =
1697- regex:: Regex :: new ( r"find target/stm32f4" ) . unwrap ( ) ;
1698- let g0 =
1699- regex:: Regex :: new ( r"find target/stm32g0" ) . unwrap ( ) ;
1700-
1701- let mut c: Option < String > = None ;
1702-
1703- for s in d. split ( '\n' ) {
1704- if h7. is_match ( s) {
1705- c = Some ( "STM32H753ZITx" . to_string ( ) ) ;
1706- break ;
1707- }
1708- if f3. is_match ( s) {
1709- c = Some ( "STM32F301C6Tx" . to_string ( ) ) ;
1710- break ;
1711- }
1712- if f4. is_match ( s) {
1713- c = Some ( "STM32F401CBUx" . to_string ( ) ) ;
1714- break ;
1715- }
1716- if g0. is_match ( s) {
1717- c = Some ( "STM32G030C6Tx" . to_string ( ) ) ;
1718- break ;
1719- }
1720- }
1721- c
1722- }
1723- _ => bail ! ( "Unexpected config?" ) ,
1724- } ,
1725- None => {
1726- bail ! ( "archive flash.ron is missing both probe-rs chip \
1727- name and legacy flash config") ;
1728- }
1729- } ,
1638+ None => bail ! ( "must specify a chip in your config" ) ,
17301639 } ;
17311640
17321641 Ok ( HubrisFlashConfig {
0 commit comments