shithub: p9-stm32-example-bare

ref: 91f14160d425ce557a3fc589b9286fd82c56b7a8
dir: /util.rc/

View raw version
#!/bin/rc

baudrate=19200
kernel=kernel

fn stm_info {
	echo 'using flashdev' $flashdev 'with baud' $baudrate
	if(! ~ $flashdev '') {
		stm32up -d -D $flashdev -b $baudrate info
	}
	if not {
		echo '$flashdev or $baudrate not set'
	}
}

fn stm_flash {
	echo 'using flashdev' $flashdev 'with baud' $baudrate
	if(! ~ $flashdev '') {
		cat $kernel | stm32up -d -D $flashdev -b $baudrate \
			flash 0x08000000 '0x'`{cat $kernel | xd | tail -n 1}
	}
	if not {
		echo '$flashdev or $baudrate not set'
	}
}

fn stm_go {
	echo 'using flashdev' $flashdev 'with baud' $baudrate
	if(! ~ $flashdev '') {
		stm32up -d -D $flashdev -b $baudrate go 0x08000000
	}
	if not {
		echo '$flashdev or $baudrate not set'
	}
}

fn stm_wunp {
	echo 'using flashdev' $flashdev 'with baud' $baudrate
	if(! ~ $flashdev '') {
		stm32up -d -D $flashdev -b $baudrate writeunp
	}
	if not {
		echo '$flashdev or $baudrate not set'
	}
}