build: Use compile_time_request system for init, tasks, and shutdown
Avoid using linker magic to define the init, task, and shutdown functions. Instead, use the compile_time_request system. This simplifies the build and produces more efficient code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -9,9 +9,10 @@ dirs-y += lib/pru_rpmsg
|
||||
CFLAGS += -Os -mmcu=am335x.pru1
|
||||
CFLAGS += -Ilib/pru_rpmsg/include -Ilib/pru_rpmsg/include/am335x
|
||||
|
||||
CFLAGS_klipper.o := $(filter-out -mmcu=%, $(CFLAGS_klipper.o))
|
||||
CFLAGS_klipper.elf := $(CFLAGS) -minrt -T src/pru/pru.lds
|
||||
CFLAGS_klipper.elf := $(filter-out -mmcu=%, $(CFLAGS))
|
||||
CFLAGS_klipper.elf += -Wl,-r -nostdlib -Wl,-T,src/pru/pru.lds
|
||||
CFLAGS_pru0.elf := $(filter-out -mmcu=%, $(CFLAGS)) -minrt -mmcu=am335x.pru0
|
||||
CFLAGS_pru1.elf := $(CFLAGS) -minrt
|
||||
|
||||
# Add source files
|
||||
src-y := $(filter-out debugcmds.c, $(src-y))
|
||||
@@ -22,8 +23,12 @@ pru0-y := pru/pru0.c
|
||||
pru0-y += ../lib/pru_rpmsg/pru_rpmsg.c ../lib/pru_rpmsg/pru_virtqueue.c
|
||||
|
||||
# Build the additional PRU0 binary
|
||||
target-y += $(OUT)pru0.elf
|
||||
target-y += $(OUT)pru0.elf $(OUT)pru1.elf
|
||||
|
||||
$(OUT)pru0.elf: $(patsubst %.c, $(OUT)src/%.o,$(pru0-y))
|
||||
@echo " Linking $@"
|
||||
$(Q)$(CC) $(CFLAGS_pru0.elf) $^ -o $@
|
||||
|
||||
$(OUT)pru1.elf: $(OUT)klipper.elf
|
||||
@echo " Linking $@"
|
||||
$(Q)$(CC) $(CFLAGS_pru1.elf) $^ -o $@
|
||||
|
||||
@@ -75,7 +75,7 @@ irq_poll(void)
|
||||
_irq_poll();
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
timer_shutdown(void)
|
||||
{
|
||||
// Reenable timer irq
|
||||
@@ -86,12 +86,13 @@ timer_shutdown(void)
|
||||
}
|
||||
DECL_SHUTDOWN(timer_shutdown);
|
||||
|
||||
static void
|
||||
void
|
||||
timer_init(void)
|
||||
{
|
||||
CT_IEP.TMR_CNT = 0;
|
||||
timer_shutdown();
|
||||
}
|
||||
DECL_INIT(timer_init);
|
||||
|
||||
|
||||
/****************************************************************
|
||||
@@ -211,8 +212,6 @@ main(void)
|
||||
;
|
||||
writel(&SHARED_MEM->signal, SIGNAL_PRU1_READY);
|
||||
|
||||
timer_init();
|
||||
|
||||
sched_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user