diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53829d9fa..8c4a440d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,13 @@ jobs: # runtime-ref: ${{ github.ref }} # compiler-ref: ${{ needs.fetch-lf.outputs.ref }} + lf-default-zephyr: + needs: fetch-lf + uses: lf-lang/lingua-franca/.github/workflows/c-zephyr-tests.yml@master + with: + runtime-ref: ${{ github.ref }} + compiler-ref: ${{ needs.fetch-lf.outputs.ref }} + lf-default: needs: fetch-lf uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master diff --git a/core/platform/lf_zephyr_support.c b/core/platform/lf_zephyr_support.c index a14598a7f..66763fbc8 100644 --- a/core/platform/lf_zephyr_support.c +++ b/core/platform/lf_zephyr_support.c @@ -47,6 +47,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Keep track of overflows to keep clocks monotonic static int64_t _lf_timer_epoch_duration_nsec; +static int64_t _lf_timer_epoch_duration_usec; static volatile int64_t _lf_timer_last_epoch_nsec = 0; #if defined(LF_ZEPHYR_CLOCK_HI_RES) @@ -108,9 +109,11 @@ void lf_initialize_clock() { while(1) {}; } - // Calculate the duration of an epoch + // Calculate the duration of an epoch. Compute both + // nsec and usec now at boot to avoid these computations later counter_max_ticks = counter_get_max_top_value(_lf_counter_dev); - _lf_timer_epoch_duration_nsec = counter_ticks_to_us(_lf_counter_dev, counter_max_ticks) * 1000LL; + _lf_timer_epoch_duration_usec = counter_ticks_to_us(_lf_counter_dev, counter_max_ticks); + _lf_timer_epoch_duration_nsec = _lf_timer_epoch_duration_usec * 1000LL; // Set the max_top value to be the maximum counter_max_ticks = counter_get_max_top_value(_lf_counter_dev); @@ -137,8 +140,10 @@ void lf_initialize_clock() { LF_PRINT_LOG("Using Low resolution zephyr kernel clock"); LF_PRINT_LOG("Kernel Clock has frequency of %u Hz\n", CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC); _lf_timer_last_epoch_nsec = 0; - // Compute the duration of an + // Compute the duration of an epoch. Compute both + // nsec and usec now at boot to avoid these computations later _lf_timer_epoch_duration_nsec = ((1LL << 32) * SECONDS(1))/CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC; + _lf_timer_epoch_duration_usec = _lf_timer_epoch_duration_nsec/1000; #endif } diff --git a/include/core/platform/lf_zephyr_support.h b/include/core/platform/lf_zephyr_support.h index 7baa70571..e446bdf71 100644 --- a/include/core/platform/lf_zephyr_support.h +++ b/include/core/platform/lf_zephyr_support.h @@ -62,7 +62,6 @@ typedef int64_t _interval_t; typedef uint32_t _microstep_t; #ifdef LF_THREADED -#warning "Threaded support on Zephyr is still experimental" typedef struct k_mutex _lf_mutex_t; typedef struct k_condvar _lf_cond_t;