Host ———————————————————————
::host::
::dtc:: cr ." *** DTC not supported ***" cr bye
Target ——————————————————————-
::target::
$08000000 to trom
$20000000 to tram
4 to tcell
trom tdp !
tram tvp !
tram $00001000 + t, 0 t,
trom $00000400 + torg
../cpus/cortex-m0/armv6-m-primitives.ft
::stc:: include ../cpus/cortex-m0/threading-stc.ft
::itc:: include ../cpus/cortex-m0/threading-itc.ft
$FC buffer: psp
variable s0
$FC buffer: rsp
variable r0
: emit begin USART2_ISR c@ %10000000 and until USART2_TDR c! ;
: key? USART2_ISR c@ %00100000 and ;
: key begin key? until USART2_RDR c@ ;
::stc:: include ../common/threading-stc.ft
::itc:: include ../common/threading-itc.ft
: 16mhz %00000001 RCC_CR ! begin RCC_CR @ %00000100 and until
%00000001 RCC_CFGR !
;
: uart-init %00100000000000000000 RCC_APB1ENR bis!
GPIOA_MODER dup @ $3FFFFFCF and $80000020 or swap !
GPIOA_AFRL dup @ $FFFFF0FF and $00000400 or swap !
GPIOA_AFRH dup @ $0FFFFFFF and $40000000 or swap !
RCC_CCIPR dup @ $FFFFFFF3 and $00000008 or swap !
#138 USART2_BRR !
%00001101 USART2_CR1 bis!
;
: led-init GPIOB_MODER dup @ $FFFFFF3F and $00000040 or swap ! ;
: +led $00000008 GPIOB_BSRR ! ;
: -led $00000008 GPIOB_BRR ! ;
: ~led GPIOB_IDR @ $00000008 xor GPIOB_ODR ! ;
: hw-init %00000000000000000011 RCC_IOPENR !
16mhz
led-init
uart-init
;
: cold s0 sp! r0 rp!
0 (source-id) !
setup-vars
hw-init
hex
abort
begin wfi again
;
Host ———————————————————————
::host::
::stc:: s" nucleo-l031k6-stc.hex" save-hex
::itc:: s" nucleo-l031k6-itc.hex" save-hex