That s pretty system dependent. In most cases, the answer is going to be no - you will need to write some custom assembly to set up the C runtime before you start running your C code. There are some exceptions, however. The ARM Cortex-M0, for example, can run C code straight out of reset.
简言之,你不再使用M0,因此,你需要写一些集会。 同样,它依赖系统/芯片,但你可能能够放弃简单的东西:
reset_vector:
mov sp, SOME_KNOWN_GOOD_STACK_ADDRESS
call c_entry_point
这只是先入住脚点,把我们的C方案放在切入点。 当然,这种简单的设置取决于您的心灵,即有一个支持它的复发病媒/病媒表,而区域援助团(或像区域援助团)是在重新启动病媒之前启动的,等等。 早期系统启动时往往有许多“障碍”。
Prepare to get pretty friendly with your compiler, assembler, and linker documentation - generating a flat binary that you can flash down as a first stage bootloader is often a big pain in and of itself.
亲爱!