I'm trying to do a simple ulp test that act as counter:
this is my ULP code:
Code: Select all
const ulp_insn_t ulp_asm[] = {
I_MOVI(R3, 32), // R0 <- 32
I_LD(R2, R3, 0), // R1 <- RTC_SLOW_MEM[R3]
I_ADDR(R2, R2, 1), // R1 <- R1 + R1
I_ST(R2, R3, 0), // R1 -> RTC_SLOW_MEM[R3 + 0]
I_HALT(),
};
Code: Select all
RTC_SLOW_MEM[32] = 10;
printf("RTC_SLOW_MEM[32] is %d\n", RTC_SLOW_MEM[32] & 0xffff);
size_t size = sizeof(ulp_asm) / sizeof(ulp_insn_t);
printf("Load ulp program of size %d...\n", size);
ulp_process_macros_and_load(0, ulp_asm, &size);
ulp_run(0);
Code: Select all
void update_count(void *pvParameter) {
printf("Show ulp hints!\n");
for (int i = 100; i >= 0; i--) {
printf("hit readed %d \n", RTC_SLOW_MEM[32] & 0xffff);
vTaskDelay(1000 / portTICK_RATE_MS);
}
printf("Restarting now.\n");
fflush(stdout);
system_restart();
}
thanks in advance
claudio