44 lines
661 B
C
44 lines
661 B
C
#include "bsp_init.h"
|
|
#include "stm32f4xx.h"
|
|
#include "stdio.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern const unsigned int bsp_init_start;
|
|
extern const unsigned int bsp_init_end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ³õʼ»¯ËùÓÐÍâÉè
|
|
int bsp_init_all(void)
|
|
{
|
|
init_call_fun *start=(init_call_fun *)&bsp_init_start;
|
|
init_call_fun *end=(init_call_fun *)&bsp_init_end;
|
|
|
|
int ret=0;
|
|
init_call_fun *ptr=0;
|
|
for(ptr=start;ptr<end;ptr++)
|
|
{
|
|
if(ptr->init)
|
|
{
|
|
int err=0;
|
|
if(err=ptr->init(),err)
|
|
{
|
|
printf("%s:%s init failed,err=%d\r\n",__func__,ptr->name,err);
|
|
ret=err;
|
|
}
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
|
|
|
|
|
|
|