(command.CommandList
  children: [
    (command.ShFunction
      name: do_build
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:descr)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:board)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                )
              ]
            )
            (C {(shift)})
            (C {(shift)})
            (C {(echo)} 
              {(DQ ('building ') ($ VSub_DollarName '$descr') (' ') ($ VSub_DollarName '$board'))}
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:build_dir)
                  op: Equal
                  rhs: {(/tmp/stm-build-) ($ VSub_DollarName '$board')}
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(make)} {(-B)} {($ VSub_At '$@')} 
                  {(Lit_VarLike 'BOARD=') ($ VSub_DollarName '$board')} {(Lit_VarLike 'BUILD=') ($ VSub_DollarName '$build_dir')}
                )
                (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
              ]
            )
            (C {(mv)} {($ VSub_DollarName '$build_dir') (/firmware.dfu)} 
              {($ VSub_DollarName '$dest_dir') (/) ($ VSub_DollarName '$descr') (-) 
                ($ VSub_DollarName '$date') (-) ($ VSub_DollarName '$git_tag') (.dfu)
              }
            )
            (C {(rm)} {(-rf)} {($ VSub_DollarName '$build_dir')})
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Lit_LBracket '[')} {($ VSub_Pound '$#')} {(KW_Bang '!') (Lit_Equals '=')} {(1)} 
                  {(Lit_RBracket ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('usage: ') ($ VSub_Number '$0') (' <dest-dir>'))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:dest_dir) op:Equal rhs:{($ VSub_Number '$1')})]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: (C {(Lit_LBracket '[')} {(KW_Bang '!')} {(-r)} {(modpyb.c)} {(Lit_RBracket ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('must be in stm directory'))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:date)
          op: Equal
          rhs: 
            {
              (command_sub
                left_token: <Left_DollarParen '$('>
                command_list: (command.CommandList children:[(C {(date)} {(SQ <'+%Y-%m-%d'>)})])
              )
            }
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:git_tag)
          op: Equal
          rhs: 
            {
              (DQ 
                (command_sub
                  left_token: <Left_DollarParen '$('>
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Op_DPipe]
                          children: [(C {(git)} {(describe)} {(--dirty)}) (C {(echo)} {(unknown)})]
                        )
                      ]
                    )
                )
              )
            }
        )
      ]
    )
    (C {(do_build)} {(pybv3)} {(PYBV3)})
    (C {(do_build)} {(pybv3-network)} {(PYBV3)} {(Lit_VarLike 'MICROPY_PY_WIZNET5K=') (1)} 
      {(Lit_VarLike 'MICROPY_PY_CC3K=') (1)}
    )
    (C {(do_build)} {(pybv10)} {(PYBV10)})
    (C {(do_build)} {(pybv10-network)} {(PYBV10)} {(Lit_VarLike 'MICROPY_PY_WIZNET5K=') (1)} 
      {(Lit_VarLike 'MICROPY_PY_CC3K=') (1)}
    )
    (C {(do_build)} {(stm32f4disc)} {(STM32F4DISC)})
    (C {(do_build)} {(espruino-pico)} {(ESPRUINO_PICO)})
  ]
)