OpenCores
no use no use 1/1 no use no use
timerled.c: C-Code for fusesoc with or1k-elf-gcc compiler
by jo58 on Feb 15, 2016
jo58
Posts: 7
Joined: Oct 31, 2015
Last seen: Jun 28, 2016

Hi,

I working with a FuseSoC on an Altera Cyclone IV FPGA.
I used
http://opencores.org/or1k/ORCONF2013_Workshop_ORPSoC_On_DE0_Nano
as a guideline.

I'm having trouble compiling the given C-Code examples. It seems that changes have been made in the "or1k-support.h" or/and "spr-defs.h" file.

I tried to compile the "timerled.c" file from:
https://github.com/juliusbaxter/orconf2013.git

I changed SPR_TTMR_PERIOD to SPR_TTMR_TP which seems to be the new name.
I also used or1k_timer_get_ticks() instead of or1k_timer_ticks.

But how do I have to change or1k_timer_period?
And what about __uart_getc()?

I'm pretty new to this matter.

Best regards

RE: timerled.c: C-Code for fusesoc with or1k-elf-gcc compiler
by jo58 on Feb 17, 2016
jo58
Posts: 7
Joined: Oct 31, 2015
Last seen: Jun 28, 2016

I just found out that or1k_timer_get_ticks() always returns zero
even when I use the given example from the "or1k-support.h" file:


#include <or1k-support.h>
#include <stdio.h>
#include <spr-defs.h>


int main() {
  printf("\nStart\n");
  uint32_t ticks = 0;
  uint32_t timerstate;
  or1k_timer_init(100);
  or1k_timer_enable();
  while (1) {
    while (ticks == or1k_timer_get_ticks()) { }
    timerstate = or1k_timer_disable();
    or1k_timer_restore(timerstate);
    if (ticks == 100) {
      printf("A second elapsed\n");
      or1k_timer_reset_ticks();
      ticks = 0;
    }
  }
}

How is this possible?
What could be the cause for this problem?

RE: timerled.c: C-Code for fusesoc with or1k-elf-gcc compiler
by wallento on Feb 17, 2016
wallento
Posts: 28
Joined: Jan 24, 2009
Last seen: Nov 8, 2018
Hi,

I am responsible for this issue I think. Please give me a few days to check it.

Cheers,
Stefan
RE: timerled.c: C-Code for fusesoc with or1k-elf-gcc compiler
by wallento on Mar 3, 2016
wallento
Posts: 28
Joined: Jan 24, 2009
Last seen: Nov 8, 2018
Sorry, for the delay. Did you also use the toolchain in the tutorial?

The latest one can be found here: http://openrisc.io/newlib/

I will test it with this one now.

Best,
Stefan
RE: timerled.c: C-Code for fusesoc with or1k-elf-gcc compiler
by wallento on Mar 3, 2016
wallento
Posts: 28
Joined: Jan 24, 2009
Last seen: Nov 8, 2018
Hi again,

the tutorial is outdated unfortunately. I will try to bring up a revised version soon, meanwhile please try the latest toolchain.

Best,
Stefan
no use no use 1/1 no use no use
© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.