[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclinux-dev
Subject:    [uClinux-dev] SIGILL using timer in mcf5307
From:       angelo <angelo70 () gmail ! com>
Date:       2016-06-12 12:55:23
Message-ID: 575D5BBB.1040409 () gmail ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="DejaVu Sans Mono">Hi all,<br>
      <br>
      i was testing a linux setitimer to make some led blink, <br>
      from following c++ code:<br>
      <br>
      static void timer_handler(int signum)<br>
      {<br>
          static unsigned short value = 0xff;<br>
      <br>
          *((unsigned short *)0x10000248) = (value &amp; 0xff);<br>
      <br>
          value = ~value;<br>
      }<br>
      <br>
      string cmd_parser::on_cmd_blink(const string &amp;state)<br>
      {<br>
          stringstream ss;<br>
          struct sigaction sa;<br>
          struct itimerval timer;<br>
      <br>
          memset(&amp;timer, 0, sizeof(struct itimerval));<br>
      <br>
          if (state == "on") {<br>
              /* install timer_handler as the signal handler for
      SIGALRM. */<br>
              memset(&amp;sa, 0, sizeof(sa));<br>
              sa.sa_handler = &amp;timer_handler;<br>
              sigaction(SIGALRM, &amp;sa, NULL);<br>
      <br>
              /* configure the timer to expire after 0,5 sec... */<br>
              timer.it_value.tv_sec = 0;<br>
              timer.it_value.tv_usec = 500000;<br>
              /* ... and every 0,5 sec after that. */<br>
              timer.it_interval.tv_sec = 0;<br>
              timer.it_interval.tv_usec = 500000;<br>
      <br>
              setitimer(ITIMER_REAL, &amp;timer, NULL);<br>
    </font><br>
    <font face="DejaVu Sans Mono"><font face="DejaVu Sans Mono">       
        ss &lt;&lt; "blinking on\r\n";             
        &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>
        <br>
      </font>    } else if (state == "off") {<br>
              /* timer stop */<br>
              setitimer(ITIMER_REAL, &amp;timer, NULL);<br>
      <br>
              ss &lt;&lt; "blinking disabled\r\n";<br>
          }<br>
      <br>
          return ss.str();<br>
      }<br>
      <br>
      <br>
      If i leave the line above marked with "</font><font face="DejaVu
      Sans Mono"><font face="DejaVu Sans Mono"><font face="DejaVu Sans
          Mono">&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;" <br>
          i get SIGILL on the execution of setitimer<br>
          <br>
          if i comment the line out, timer works properly and led
          blinks.<br>
          <br>
          <br>
          I have:<br>
          mcf5307<br>
          ~ # cat /proc/version <br>
          uClinux version 3.10.0-uc0amcore-001 (angelo@jerusalem) (gcc
          version 4.5.1 (GCC) ) #70 Wed May 4 21:37:35 CEST 2016<br>
          ~ # <br>
          <br>
          makefile:<br>
PREFIX=/opt/toolchains/m68k/Sourcery_CodeBench_Lite_for_ColdFire_uClinux/bin/m68k-uclinux-<br>
          <br>
          CPP=$(PREFIX)g++<br>
          STRIP=$(PREFIX)strip<br>
          FLTHDR=$(PREFIX)flthdr<br>
          LD=$(PREFIX)ld<br>
          <br>
          BINNAME=cfbot<br>
          <br>
          BINDIR=bin<br>
          SRCDIR=src<br>
          OBJDIR=obj<br>
          <br>
          INCLUDES=-Iinclude<br>
          <br>
          SRCS:= $(wildcard $(SRCDIR)/*.cc)<br>
          OBJS:= $(patsubst %.cc,%.o,$(SRCS))<br>
          OBJS:= $(patsubst $(SRCDIR)%,$(OBJDIR)%,$(OBJS))<br>
          <br>
          CFLAGS=-Os -s -m5307 -ffunction-sections -fdata-sections<br>
          LDFLAGS=-m5307 -Wl,--gc-sections<br>
          LIBS=<br>
          <br>
          TFTP="192.168.0.80\\nmode binary\\nput bin/cfbm /tmp"<br>
          <br>
          $(BINDIR)/$(BINNAME): $(OBJS)<br>
              $(CPP) $(OBJS) $(LDFLAGS) -o $@ $(LIBS)<br>
          #    $(STRIP) $@<br>
          #    $(FLTHDR) -s 65535 $@<br>
          #    atftp --option "mode octet" -p -l $(BINDIR)/$(BINNAME) -r
          /tmp/$(BINNAME) 192.168.0.80<br>
          <br>
          $(OBJDIR)/%.o: $(SRCDIR)/%.cc<br>
              $(CPP) $(CFLAGS) $(INCLUDES) -Wall -c -o $@ $&lt;<br>
          <br>
          clean:<br>
              rm -f bin/*<br>
              rm -f obj/*.o<br>
          <br>
          <br>
          Every help is appreciated,<br>
          <br>
          thanks,<br>
          angelo<br>
          <br>
          <br>
          <br>
          <br>
          <br>
        </font></font><br>
    </font>
  </body>
</html>


_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic