Tuesday, December 18, 2012

GDB 7.1 doesn't compile!

In order to get the armsupp.c file to compile in gdb-7.1, I had to make the return actually return something. Just a note for those of you who use arm-elf-gdb on macports, it will not compile out of the box. I've included the function in question, the change needs to be at the "here" note.
/* This function does the Busy-Waiting for an MRC instruction.  */

ARMword
ARMul_MRC (ARMul_State * state, ARMword instr)
{
  unsigned cpab;
  ARMword result = 0;

  if (! CP_ACCESS_ALLOWED (state, CPNum))
    {
      ARMul_UndefInstr (state, instr);
      return(0); // <-- here
    }

  cpab = (state->MRC[CPNum]) (state, ARMul_FIRST, instr, &result);
  while (cpab == ARMul_BUSY)
    {
      ARMul_Icycles (state, 1, 0);
      if (IntPending (state))
 {
   cpab = (state->MRC[CPNum]) (state, ARMul_INTERRUPT, instr, 0);
   return (0);
 }
      else
 cpab = (state->MRC[CPNum]) (state, ARMul_BUSY, instr, &result);
    }
  if (cpab == ARMul_CANT)
    {
      ARMul_Abort (state, ARMul_UndefinedInstrV);
      /* Parent will destroy the flags otherwise.  */
      result = ECC;
    }
  else
    {
      BUSUSEDINCPCN;
      ARMul_Ccycles (state, 1, 0);
      ARMul_Icycles (state, 1, 0);
    }

  return result;
}

Sunday, December 16, 2012

Matlab does not print whole numbers!

Actually, it does, but it decides what is an "integer". For example:
sprintf('%i',dac_start(4))
This returned 3.317660e+004 even though I told Matlab to print with %i. The solution is to round the number, resulting:
sprintf('%i',round(dac_start(4)))
ans =
33177
Until I realized that my number 33176.6, I was going batty. round() solved the problem.

Saturday, December 8, 2012

macports php5 iconv

I was surprised to find that on macports, php5 does not have iconv included by default.
To get started, I removed all of the versions of PHP that I had, and then did:

sudo port install php5 +apache2 +mysql5 +pear +postgresql +pear php5-curl php5-gd php5-iconv php5-imagick php5-imap php5-mbstring php5-mcrypt php5-mysql php5-pcntl php5-posix php5-soap php5-sockets php5-sqlite php5-xmlrpc php5-xsl php53-apache2handler

After doing that, I still didn't have iconv loading even though apache was loading php. I had to update php.ini with the extensions explicitly. I had to also specify the path:
extension=/opt/local/lib/php/extensions/no-debug-non-zts-20090626/iconv.so

(remember to check phpinfo(); to see which php.ini file is being used!)

Thursday, December 6, 2012

wheretobreakaword

You have to be careful in English of where you break a domain name:
http://www.hawaiinewsnow.com/ Hawaii New Snow or Hawaii News Now?
This consignment store:
http://kidsexchange.net/
...might not have thought their domain name through.

Sunday, December 2, 2012

In this article, the following is stated:
The line of code seems basic, even for BASIC. There aren’t any variables. It uses a GOTO instead of a more elegant loop.  How could something so short and simple generate such a complex result? What can this one line—“10 PRINT,” to use the authors’ shorthand—teach us about software, and culture at large?

I find Computer Scientists to be a fickle bunch because they are told that they are mathematicians; however, they fancy themselves as artists. The line "It uses a GOTO instead of a more elegant loop" is an excellent example of how removed most people are from hardware. A "while()" is just conditional branches, which are just "GOTO".
The x86 assembly for:
void main()
{
   while(1){;;}
}
results in:
_main:
Leh_func_begin1:
        pushq   %rbp
Ltmp0:
        movq    %rsp, %rbp
Ltmp1:
LBB1_1:
        jmp     LBB1_1      //<--jmp is a GOTO
Leh_func_end1:
...which just proves that hardware is "inelegant". I would say that it is very efficient with a single instruction jump, and simplicity is elegant.

24 hour party people

As a huge fan of music, I have a lot of respect for Factory Records and Tony Wilson (RIP). I finally got around to watching 24 Hour Party People. If you are music fan, it's a must-see.

While on the topic of music, Human Traffic is a fine movie based on music and counter culture as well. Stick to the UK version. You too can have Mr. Floppy:

...for just under 13 quid.

Saturday, December 1, 2012

一角獣?

North Korea has found the tomb of the Unicorns. Just remember, it is not the news unless it is the official news, even if it has unicorns.