use write_bit
cleanup cortex.c