view target-utils/compalstage/compalstage.S @ 497:74610c4f10f7

target-utils: added 10 ms delay at the end of abb_power_off() The deosmification of the ABB access code (replacement of osmo_delay_ms() bogus delays with correctly-timed ones, which are significantly shorter) had one annoying side effect: when executing the poweroff command from any of the programs, one last '=' prompt character was being sent (and received by the x86 host) as the Calypso board powers off. With delays being shorter now, the abb_power_off() function was returning and the standalone program's main loop was printing its prompt before the Iota chip fully executed the switch-off sequence! I thought about inserting an endless tight loop at the end of the abb_power_off() function, but the implemented solution of a 10 ms delay is a little nicer IMO because if the DEVOFF operation doesn't happen for some reason in a manual hacking scenario, there won't be an artificial blocker in the form of a tight loop keeping us from further poking around.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 25 May 2019 20:44:05 +0000
parents 21eec7569eb8
children
line wrap: on
line source

	.text
	.org	0

#if THUMB_ENTRY
	.code	16
	bx	pc
	nop
#endif
	.code	32

/* delay loop like OsmocomBB does */
	mov	r1, #0xa0000
1:	subs	r1, r1, #1
	bne	1b
/* enable the Calypso boot ROM */
	ldr	r1, reg_addr
	mov	r2, #0x0100
	strh	r2, [r1]
/* jump to it! */
	mov	pc, #0
reg_addr:
	.word	0xFFFFFB10

#if PAD_TO_1003
/*
 * The older and most familiar versions of C139/140 boot code expect the
 * signature bytes to be "1003" or greater, but a recently encountered
 * newer version expects them to be "1004" or greater instead.  As the
 * actual comparison check in all currently known boot code versions is
 * an inequality (the signature bytes in the downloaded image need to be
 * greater than or equal to the hard-coded reference values), always
 * putting "1004" in our compalstage image instead of "1003" should satisfy
 * all existing C1xx boot code versions, or at least all currently known
 * ones.  However, having an image named compalstage-1003.bin with the
 * corresponding -c 1003 loadtools option that is actually "1004" inside
 * feels a little "wrong" in some sense, while getting rid of the -c 1003
 * option would break old user instructions, hence let's go ahead and do the
 * silly exercise of building both "1003" and "1004" versions.
 */
	.org	0x3be0
#if MAGIC_1004
	.ascii	"1004"
#else
	.ascii	"1003"
#endif
#endif