rtems 文件系统(4)

上一篇中说道 这个地方是入口,再向上追溯,可以找到在cpukit/libcsupport/include/rtems/libio.h中

定义了这个函数指针类型,typedef void (*rtems_libio_helper)(void);

然后下面定义了一个该类型的函数指针。 rtems_fs_init_helper

const rtems_libio_helper rtems_fs_init_helper =
  #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
    rtems_libio_helper_null;
  #else
    rtems_filesystem_initialize;  //这个地方是入口
  #endif

那么这个函数指针在哪里调用呢?cpukit/libcsupport/src/libio_init.c

在函数 rtems_libio_init的最后调用

  /*
   *  Initialize the base file system infrastructure.
   */
  (* rtems_fs_init_helper)(); //函数指针调用

rtems_libio_init也在cpukit/sapi/include/confdefs.h 中有定义,如下所示

const rtems_libio_helper rtems_libio_init_helper =
  #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
    rtems_libio_helper_null;
  #else
    rtems_libio_init;
  #endif

套路是一样的。也是函数指针。所以函数指针rtems_libio_init_helper 在哪里被调用呢?

在c/src/lib/libbsp/shared/bsplibc.c中的函数bsp_libc_init中调用。

而函数bsp_libc_init就在c/src/lib/libbsp/shared/bootcard.c中的boot_card函数调用

boot_card在start.s中调用,这就是上电后

c/src/lib/libbsp/arm/shared/start/start.S

start.s中一开始程序会进入到_start:

/* Start entry */
_start:  
后面省略

那么_start:是从下面跳转过去的,所以系统一上电复位以后,会进入复位的中断处理函数。

handler_addr_reset:

#ifdef BSP_START_RESET_VECTOR    //这个宏没有定义
.word BSP_START_RESET_VECTOR
#else
.word _start
#endif

上面说的那个宏定义定义需要查询bspopts.h 这个文件是生成特定的bsp的时候才有,源码中没有,源码中只有一些配置的选择。所以,会跳转到_start

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值