Hi all,
I tried to learn for SPE-fw number of clock ticks elapsed since the program was launched.To get the number of seconds used by the CPU.
How could I get like this output of trigger real time system(FreeRTOS for Tx2).
I can use <time.h> in host pc with gcc but not work in SPE-fw.
output of following my host pc:
0.791106 sec
0.791109 sec
0.791111 sec
0.791113 sec
0.791115 sec
But Im getting following error in tx2 SPE-fw
timesr.c:(.text._times_r+0x2): undefined reference to `_times'
in my spe-fw code. How could I fix it or which library can I use?
#include<time.h>
...
...
...
char newLine[2] = " \n";
int newLineLength = sizeof(newLine) - 1;
char output[12];
int outputLength;
char tx_message[] = "LED OFF : ";
int tx_len = sizeof(tx_message) - 1;
char tx_message2[] = "LED ON - ";
int tx_len2 = sizeof(tx_message2) - 1;
start = clock();
double time_taken = 0.0;
while (1) {
printf("%s - Setting GPIO_APP_OUT to 1 - IRQ should trigger\r\n",
__func__);
gpio_set_value(GPIO_APP_OUT, 1);
vTaskDelay(GPIO_OUT_SET_DELAY);
end = clock();
time_taken = (double)(end - start) / CLOCKS_PER_SEC;
tegra_uart_write_now(&UART_APP_PORT, tx_message, tx_len);
snprintf(output, 12, "%f", time_taken);
outputLength = sizeof(output) - 1;
tegra_uart_write_now(&UART_APP_PORT, output, outputLength);
tegra_uart_write_now(&UART_APP_PORT, newLine, newLineLength);
gpio_set_value(GPIO_APP_OUT, 0);
vTaskDelay(GPIO_OUT_SET_DELAY);
end = clock();
time_taken = (double)(end - start) / CLOCKS_PER_SEC;
tegra_uart_write_now(&UART_APP_PORT, tx_message2, tx_len2);
snprintf(output, 12, "%f", time_taken);
outputLength = sizeof(output) - 1;
tegra_uart_write_now(&UART_APP_PORT, output, outputLength);
tegra_uart_write_now(&UART_APP_PORT, newLine, newLineLength);
};