Using new and delete in C++ on Cortex-M3

A nice way to precisely time the instantiation of an object in C++  is to use the new and delete operators. Normally, an global object is instantiated at a undefined time – the compiler decides on this, not a language standard.

Whilst delete would not be of great use in an embedded system without good memory management (the easiest implementation would be the  BGET package), new can be used efficiently to cater for a linear instantiation where the user decides when to instantiate.

If you want to use C++ without the bloat, you’re probably forced to provide your own new and delete routines. On Cortex-M3, this can be tricky.

Although the core supports unaligned memory access, unaligned multiple LDM, STM, LDRD and STRD calls will cause a Usage Fault exception. Also, using unaligned data decreases performance. When instantiating a class with a multitude of variables listed in the class, the allocated memory block could well be unaligned. Also, code could conceivably be generated that will execute a number of LDM or LDRD instructions, for example, in the constructor of the object.  It is therefore imperative that a new call will always return an aligned block of data.

A simple way to implement new and delete would be like this :

static void * toewijzing(const size_t size) /* let op: size geeft het aantal bytes aan */
{
    static UInt8 *heap_ptr = (UInt8 *)(__bss_end);
    const UInt8 *base = heap_ptr;       /*  Point to end of heap.  */
    const UInt8 *eindeSRAM = (const UInt8 *)__TOP_STACK;        

    if ((heap_ptr+size) < eindeSRAM)
    {
        heap_ptr += size;       /*  Increase heap met size aantal bytes  */
    }
    else
    {
        while(1);
        KiwandaAssert(0);
    }

    return((void *)base);               /*  Return pointer to start of new heap area.  */
}

void * operator new(size_t size) /* let op: size geeft het aantal bytes aan */
{
    return(toewijzing(size));
} 

void * operator new[](size_t size)
{
    return(toewijzing(size));
} 

void operator delete(void * ptr)
{
    // free(ptr);
} 

void operator delete[](void * ptr)
{
    //free(ptr);
}

The linker will provide the location of the end of the used SRAM space (__bss_end) and the end of the SRAM block (__TOP_STACK).  An example would be the following Linker Load file, used for the Energy Micro EFM32G880F64 processor:

************************************************************************
ARM Cortex M-3 standaard microcontroller loadscript.
Memory I/O adressen, aangepast aan eigenschappen
van de Energy Micro EFM32G880F64 Microcontroller

Alle aanpassingen in dit bestand zijn
(c) 2008-2011 Kiwanda Embedded Systemen
Voor alle overige software geldt het copyright van Atmel

$Id: efm32g880f64.ld 3041 2011-08-28 20:29:52Z oldenburgh $
************************************************************************/

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)

MEMORY
{
  FLASH (rx)   : ORIGIN = 0x00000000, LENGTH = 64K
  DATA (rw)    : ORIGIN = 0x20000000, LENGTH = 16K
}

__TOP_STACK    = ORIGIN(DATA) + LENGTH(DATA);

/* Section Definitions */

SECTIONS
{
  /* first section is .text which is used for code */

  . = ORIGIN(FLASH);
  .text :
  {
        KEEP(*(.cortexm3vectors))      /* core exceptions */
        KEEP(*(.geckovectors))          /* efm32 exceptions */
        . = ALIGN(4);
        KEEP(*(.init))
        CREATE_OBJECT_SYMBOLS
        *(.text .text.*)                   /* C en C++ code */
        *(.gnu.linkonce.t.*)
        *(.glue_7)
        *(.glue_7t)
        *(.vfp11_veneer)
        *(.ARM.extab* .gnu.linkonce.armextab.*)
        *(.gcc_except_table)
        . = ALIGN(4);
   } >FLASH

__exidx_start = .;
.ARM.exidx   : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
__exidx_end = .;

   . = ALIGN(4);

        .rodata : ALIGN (4)
        {
                *(.rodata .rodata.* .gnu.linkonce.r.*)

                . = ALIGN(4);
                KEEP(*(.init))

                . = ALIGN(4);
                __preinit_array_start = .;
                KEEP (*(.preinit_array))
                __preinit_array_end = .;

                . = ALIGN(4);
                __init_array_start = .;
                KEEP (*(SORT(.init_array.*)))
                KEEP (*(.init_array))
                __init_array_end = .;

                . = ALIGN(4);
                KEEP(*(.fini))

                . = ALIGN(4);
                __fini_array_start = .;
                KEEP (*(.fini_array))
                KEEP (*(SORT(.fini_array.*)))
                __fini_array_end = .;

                . = ALIGN(0x4);

                __CTOR_LIST__ = .;
                LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
                *(.ctors)
                LONG(0)
                __CTOR_END__ = .;
                __DTOR_LIST__ = .;
                LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
                *(.dtors)
                LONG(0)
                __DTOR_END__ = .;

                . = ALIGN(0x4);

                KEEP (*crtbegin.o(.ctors))
                KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
                KEEP (*(SORT(.ctors.*)))
                KEEP (*crtend.o(.ctors))

                . = ALIGN(0x4);
                KEEP (*crtbegin.o(.dtors))
                KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
                KEEP (*(SORT(.dtors.*)))
                KEEP (*crtend.o(.dtors))

                *(.init .init.*)
                *(.fini .fini.*)

                PROVIDE_HIDDEN (__preinit_array_start = .);
                KEEP (*(.preinit_array))
                PROVIDE_HIDDEN (__preinit_array_end = .);
                PROVIDE_HIDDEN (__init_array_start = .);
                KEEP (*(SORT(.init_array.*)))
                KEEP (*(.init_array))
                PROVIDE_HIDDEN (__init_array_end = .);
                PROVIDE_HIDDEN (__fini_array_start = .);
                KEEP (*(.fini_array))
                KEEP (*(SORT(.fini_array.*)))
                PROVIDE_HIDDEN (__fini_array_end = .);

                . = ALIGN (8);
                *(.rom)
                *(.rom.b)

        } >FLASH

   . = ALIGN(4);
   _etext = . ;
   PROVIDE (etext = .);

  /* .data section which is used for initialized data */

   _bdata = . ;
   PROVIDE (bdata = .);

  .data : AT(_bdata)
  {
    _data = . ;
    *(.data)            /* normale data */
    *(.data.*)        

    SORT(CONSTRUCTORS)
    . = ALIGN(4);
  } >DATA

   _edata = . ;
   PROVIDE (edata = .);

  . = ALIGN(4);

  /* .bss section which is used for uninitialized data */
  .bss(NOLOAD) :
  {
    _bss = . ;
    __bss_start = . ;
    __bss_start__ = . ;
    *(.bss)
    *(.bss.*)
    *(COMMON)
   __bss_end__ = . ;
   __bss_end   = . ;
   PROVIDE (_ebss = .) ;
  } >DATA

  . = ALIGN(4);

   _end = .;
   PROVIDE (end = .);    /* einde intern geheugen */

  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
   *(.data)            /* normale data */
    *(.data.*)        

    SORT(CONSTRUCTORS)
    . = ALIGN(4);
  } >DATA

   _edata = . ;
   PROVIDE (edata = .);

  . = ALIGN(4);

  /* .bss section which is used for uninitialized data */
  .bss(NOLOAD) :
  {
    _bss = . ;
    __bss_start = . ;
    __bss_start__ = . ;
    *(.bss)
    *(.bss.*)
    *(COMMON)
   __bss_end__ = . ;
   __bss_end   = . ;
   PROVIDE (_ebss = .) ;
  } >DATA

  . = ALIGN(4);

   _end = .;
   PROVIDE (end = .);    /* einde intern geheugen */

  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }

} /* einde secties */

When the size of the allocated block is not a multiple of 4, the next allocated block will be unaligned. In order to prevent this, allocation must always be done at multiples of 4 bytes. The next example will show this:

static void * toewijzing(const size_t size) /* let op: size geeft het aantal bytes aan */
{
    static UInt8 *heap_ptr = (UInt8 *)(__bss_end);
    const UInt8 *base = heap_ptr;       /*  Point to end of heap.  */
    const UInt8 *eindeSRAM = (const UInt8 *)__TOP_STACK;        

    if ((heap_ptr+size) < eindeSRAM)
    {
        heap_ptr += size;       /*  Increase heap met size aantal bytes en eindig op 32 bit boundary */

        while (((unsigned int)heap_ptr & 0x3) != 0)   /* bit 0 en 1 = 0 --> stappen in 4 * byte = 32 bytes */
            heap_ptr++;
    }
    else
    {
        while(1);
        KiwandaAssert(0);
    }

    return((void *)base);               /*  Return pointer to start of new heap area.  */
}

void * operator new(size_t size) /* let op: size geeft het aantal bytes aan */
{
    return(toewijzing(size));
} 

void * operator new[](size_t size)
{
    return(toewijzing(size));
} 

void operator delete(void * ptr)
{
     /* not applicable in embedded application */
} 

void operator delete[](void * ptr)
{
    /* not applicable in embedded application */
}

Advancing the heap_ptr to the next aligned address will prevent unaligned allocation to take place. The price paid for this is the loss of, at most, 3 bytes in between two allocated blocks. Since most systems have SRAM memory equal to or in excess of 16 KBytes, this won’t pose a major problem. During design of a class, careful placement of the data members will also prevent unaligned variables. Simply stated, group your equal variables together (for example, all unsigned char or unsigned short) and pad them, if necessary,  at the end with a dummy variable to grow to the 32 bit boundary:

UInt8 var1;
UInt16 var2[3];

/* total = 8+2*16 = 40 bits  -> we need 24 bits padding */
UInt8 padding[3];

This will prevent costly unaligned acces.

VVD verbaast mij al weer

Opnieuw een bericht dat mij ongelofelijk voorkomt:

“Dit betekent niks voor het Nederlandse debat”, zegt VVD-Kamerlid René Leegte. „Duitsland wil 25 procent duurzame energie opwekken. Dan zullen ze moeten importeren en laat je niks wijsmaken: dat wordt Franse kernenergie.”

Meneer Leegte (zijn naam beschrijft goed zijn denkproces) vergeet dat wij als Nederland voor een zeer groot gedeelte van onze welvaart en stabiliteit afhankelijk zijn van wat er in Duitsland gebeurt. Dat “dit niets betekent” is dan ook een lege kreet, want wat in Duitsland wordt besloten heeft altijd gevolgen voor ons. Hij sluit slechts de ogen voor het feit dat, hoe zeer hij ook een tweede Fukushima- of Tsjernobylachtige centrale in ons land wil plaatsen (waarom eigenlijk?) we links worden ingehaald door een aantal belangrijke buurlanden.

En waar is het élan gebleven? “Ze zullen wel kernenergie gaan importeren………” wat een misselijkmakende negatieve pessimistische blik op de toekomst. Vergeten wordt waar het technisch vernunft van de Duitsers toe in staat is. Je kunt beter goed proberen dan fout blijven doorgaan, maar meneer Leegte vindt fout doorgaan een echt liberaal standpunt.

Wij moeten ook het roer wenden en mee gaan doen met het Duitse initiatief. Dat levert kennis, inkomenst en en een schonere wereld op. In plaats daarvan wil de VVD (waar ik lid van ben)  als een stel conservatieve oude verstilde zakken ons geld in de bouw van een kerncentrale steken, want iets anders durven ze niet. Maar met zo’n renteniersmentalieit komen we er niet.

 

 

Compiling and linking C++ code on Cortex-M3 without exception handling and RTTI

Most embedded software is written in C, and software written for ARM Cortex-M3 devices is no exception (pun intended).

C has many qualities – small, clean, relatively easy to learn and above all a superior interface for performing low-level hardware operations – try writing a routine for manipulating I/O memory  in Algol or Fortran …… Why, then, divert to C++ and its supposed steeper learning curve? The answer lies in the size of the software project you write.

The price for using C becomes painfully apparent when projects grow beyond the “hello world” stage – the boundary usually lies around 1200-1500 lines of code. Writing a “hello world” demo in C is feasible and maintaining the source code is not hard. “Hello world” applications are in the order of 10-30 KBytes of Flash on Cortex-M3.

However, many Cortex-M3 devices typically offer more than 256 KByte of Flash, up to 2048 KBytes of Flash. A typical “serious” project for such a device would employ a number of serial interfaces, would perhaps include an embdded web server, would do floating point calculations and would interact with a user through buttons or a touch screen. Such a project would require ten thousand lines of C code or more, which translates into upward of 200 Kbytes of flash programmable binary code. Maintaining order in this code, which is centered around C’s function-oriented set-up, is awkward and error-prone. Doing so with a large developer team is even harder, as I know from experience. In C, devices typically use structs which contain init and state information, but how do you know if and where all information is filled out correctly in 15000 lines of code? Also, manually calling init functions and combining common code into lower level function/data sets requires a lot of discipline from a development team. Most experienced C programmers confronted with situation will start to write code defensively, in an object-oriented approach, in order to prevent errors and bugs. In a way, they use C++features without using the proper tools.

C++ offers everything you need to maintain order in larger embedded programs. Object Oriented programming was a focal point when the language was invented, without sacrificing backwards compatibility with existing C code. Device information is maintained in the class container, togerther with all necessary functions. Common code can be brought into lower base classes, enabling the sharing of the code by virtue of the inheritance mechanism of C++. It is easy to define a base interface prototype in C++ which can be used in your application code, and then use polymorphism to link your interface prototype to your device implementation. Code migration becomes very easy – your application can be brought from, let’s say STM32 to LM3S, and the only thing that you must do is develop a new interface implementation.

Problems occur when C++ is used indiscriminately. The ambivalence of many C programmers towards C++ is based on the fact that a lot of things are included in your C++ binary (bloat) which you don’t need and use.  It is important, though, to understand two things about the superset of features that C++ has with regards to C:

  • There are compile-time enhancements in C++, such as classes, virtual functions or namespaces, which are completely benign and which in most cases will not contribute to bloat. They are part of the framework that enables programmers to scale their software concepts to larger dimensions without losing overview. In larger programs, C++ will most likely lead to more compact code – see this example at GCC compiler family, but this story is also applicable to KEIL and IAR users.

    Compile your code with the -fno-rtti -fno-exceptions flags (the others such as -ggdb aren’t relevant to this discussion but I included them anyway). My compiler lives on a FreeBSD system and is therefore placed in /usr/local/bin. I named it arm-eabi instead of the more common arm-none-eabi. This may be different on your system. When using Linux, for example, every distro seems to have its own peculiar spot to place applications.

    In order to prevent using exception handling and rtti at compile time:

    /usr/local/bin/arm-eabi-g++ -mthumb -c -pipe -mcpu=cortex-m3
    -mno-thumb-interwork -mapcs-frame -funsigned-char
    -fno-threadsafe-statics -Wall -Wimplicit -Wpointer-arith
    -Wswitch -Wredundant-decls -Wreturn-type -Wshadow
    -Wunused -Werror -Winline -ggdb -fno-inline
    -fno-stack-protector -fno-rtti -fno-exceptions
    -fno-unwind-tables  -Wa,-adhlns=LISTFILE -o OBJECTFILE CPPFILE

    LISTFILE, OBJECTFILE AND CPPFILE are of course to be properly named by you.

    This stops C++ from automatically inserting exception handling (and all other stdc++ library components) in your object file. But, this isn’t the complete solution! Even with the insertion of  -fno-exceptions at compile time, you will still get exception handling (and therefore bloat) when using C++ features such as new or delete. You will need to instruct the linker that it, too, should avoid all bloat components.

    At the linking stage, use the -nostdlib option to instruct the linker to omit any library file it would automatically add – in C++‘s case, libstc++.a . I use partial linking, and the linker command for that would be:

     

    /usr/local/bin/arm-eabi-g++
    -Wl,-Ur -nostdlib -Wl,Map=MAPFILE
    -o OBJCTFILE1 OBJECTFILE2 ...

     

    At the final linking step, or at the main linking step if you don’t use partial linking, you must compensate for the missing library components that you would want to include, for instance memcpy or assert. The standard C library provides many of these things and fills the missings references in most cases. Such a linking step would be like:

    /usr/local/bin/arm-eabi-g++ -mcpu=cortex-m3 -nostdlib
    -msoft-float -nostartfiles -fno-rtti -fno-exceptions
    -Wl,--cref -Wl,-Map=MAPFILE -Wl,-TLINKERSCRIPT -o ELFFILE
    -lc -lgcc -lm

    Functionality not found in libc.a such as new or delete must be provided by you – this is the price you pay for not using libstdc++! This, however, is not very difficult to do. In C++, you can use overloaded methods to insert your own version of new and delete:. I have an article that outlines how to write these functions.

     

     

Vrijheid van meningsuiting

Een kop uit de Telegraaf van vandaag:

VVD paait SGP

 

en verder in dit artikel :

“De VVD heeft haar handtekening weggehaald onder een wetsvoorstel dat zij eerder samen met D66 had ingediend om godslastering niet meer strafbaar te stellen.”

Ik ben in 2010 lid geworden va de VVD omdat ik ik vind dat iedereen in dit land mag zeggen wat hij of zij vindt, ongeacht het onderwerp. Met name de zich steeds meer roerende religieus geïnspireerde medemens moet in de openbare ruimte op afstand worden gehouden, omdat het algemeen belang (dus ook het belang van niet-gelovigen) niet gediend is met mondsnoeringen van welke aard dan ook.

De liberale beginselen onderschrijven dit volledig:

Vrijheid
Vrijheid van de mens is onmisbaar voor ontplooiing. We bedoelen dan vrijheid op geestelijk, staatkundig en materieel gebied. Deze vrijheid komt ieder mens toe, zonder enige discriminatie. De vrijheid moet zo groot mogelijk zijn. Er zijn wel grenzen aan persoonlijke vrijheid. De vrijheid van de een mag de vrijheid van de ander niet belemmeren. En we moeten oog hebben voor de belangen van toekomstige generaties.

Zolang ik bij godslastering niet verkondig dat anderen god niet mogen aanprijzen, belemmer ik hun niet in hun meningsuiting. Omgekeerd doen zij de religieuzen dit wel, door het strafrecht (niet niet de Sharia, maar ons onpartijdige, boven religies verheven strafrecht) in te zetten voor de vervolging van mensen met wie zij het niet eens zijn. Blijkbaar is hun vrijheid belangrijker dan mijn vrijheid. En nu schaart ook de liberale VVD zich in de rij van partijen die de vrijheid van meningsuiting van religieuzen belangrijker vinden dan die vrijheid van meningsuiting van anderen – de VVD laat deze discriminatie van een van haar eigen beginselen gewoon gebeuren.

Ik vind dat de VVD zich aan haar beginselen moet vasthouden bij de dagelijkse politieke besluitvorming. Als de partij zwicht voor de orthodoxe drammers van de SGP, dan zijn de eigen principes blijkbaar minder belangrijk dan de greep op de regeringsmacht.

 

 

 

 

Vrijheid van meningsuiting

Een kop uit de Telegraaf van vandaag:

VVD paait SGP

 

en verder in dit artikel :

“De VVD heeft haar handtekening weggehaald onder een wetsvoorstel dat zij eerder samen met D66 had ingediend om godslastering niet meer strafbaar te stellen.”

Ik ben in 2010 lid geworden va de VVD omdat ik ik vind dat iedereen in dit land mag zeggen wat hij of zij vindt, ongeacht het onderwerp. Met name de zich steeds meer roerende religieus geïnspireerde medemens moet in de openbare ruimte op afstand worden gehouden, omdat het algemeen belang (dus ook het belang van niet-gelovigen) niet gediend is met mondsnoeringen van welke aard dan ook.

De liberale beginselen onderschrijven dit volledig:

Vrijheid
Vrijheid van de mens is onmisbaar voor ontplooiing. We bedoelen dan vrijheid op geestelijk, staatkundig en materieel gebied. Deze vrijheid komt ieder mens toe, zonder enige discriminatie. De vrijheid moet zo groot mogelijk zijn. Er zijn wel grenzen aan persoonlijke vrijheid. De vrijheid van de een mag de vrijheid van de ander niet belemmeren. En we moeten oog hebben voor de belangen van toekomstige generaties.

Zolang ik bij godslastering niet verkondig dat anderen god niet mogen aanprijzen, belemmer ik hun niet in hun meningsuiting. Omgekeerd doen zij de religieuzen dit wel, door het strafrecht (niet niet de Sharia, maar ons onpartijdige, boven religies verheven strafrecht) in te zetten voor de vervolging van mensen met wie zij het niet eens zijn. Blijkbaar is hun vrijheid belangrijker dan mijn vrijheid. En nu schaart ook de liberale VVD zich in de rij van partijen die de vrijheid van meningsuiting van religieuzen belangrijker vinden dan die vrijheid van meningsuiting van anderen – de VVD laat deze discriminatie van een van haar eigen beginselen gewoon gebeuren.

Ik vind dat de VVD zich aan haar beginselen moet vasthouden bij de dagelijkse politieke besluitvorming. Als de partij zwicht voor de orthodoxe drammers van de SGP, dan zijn de eigen principes blijkbaar minder belangrijk dan de greep op de regeringsmacht.

 

 

 

 

Casio calculators

Recently I purchased a new calculator because someone pointed out to me the truly amazing capabilities (natural textbook display) of Casio’s new fx-115ES calculator. Costing under €30, the calculator offers an astounding 403 functions, conversions and solvers. It also displays fractions as true fractions, in addition to the standards floating point display format.. It can handle tables for linear or cubic interpolation for which the data entry is pretty easy. It performs numerical differential and integration, and solves equations with Newton-Rapson. It can even do (limited) vector and matrix calculations.

Even though I am a big fan of Texas Instruments integrated circuits (especially  their MSP430  microcontrollers, their ADCs (ADS1178) and power ICs (TPS84620) ) I prefer Casio’s calculators over TI’s. They are not as bulky, you can get your results more quickly and they cost a lot less.

When I got the new calculator , I realised I had purchased the fx-115 before. The first model I got was the fx-115 in 1985, when I was in school. Later, it also served me well as a student at Delft University of Technology.  Looking for a model that would help me with complex numbers, I bought  the fx-115W when I worked at Oresis Communications in 2001. This was my main computational workhorse in the new millennium. And, this year I purchased the amazing fx-115ES. In a way I have been quite intimate with the fx-115 family for 26 years!

All calculators, including the 26 years old fx-115, still work flawlessly, a testimony to Casio’s build quality. Begin solar driven, I never had to replace a battery. The fx-115 now lives in a kitchen drawer and is used for domestic purposes.

My calculators are  (running :

CASIOFX115familie2

 

 

 

 

Casio calculators

Recently I purchased a new calculator because someone pointed out to me the truly amazing capabilities (natural textbook display) of Casio’s new fx-115ES calculator. Costing under €30, the calculator offers an astounding 403 functions, conversions and solvers. It also displays fractions as true fractions, in addition to the standards floating point display format.. It can handle tables for linear or cubic interpolation for which the data entry is pretty easy. It performs numerical differential and integration, and solves equations with Newton-Rapson. It can even do (limited) vector and matrix calculations.

Even though I am a big fan of Texas Instruments integrated circuits (especially  their MSP430  microcontrollers, their ADCs (ADS1178) and power ICs (TPS84620) ) I prefer Casio’s calculators over TI’s. They are not as bulky, you can get your results more quickly and they cost a lot less.

When I got the new calculator , I realised I had purchased the fx-115 before. The first model I got was the fx-115 in 1985, when I was in school. Later, it also served me well as a student at Delft University of Technology.  Looking for a model that would help me with complex numbers, I bought  the fx-115W when I worked at Oresis Communications in 2001. This was my main computational workhorse in the new millennium. And, this year I purchased the amazing fx-115ES. In a way I have been quite intimate with the fx-115 family for 26 years!

All calculators, including the 26 years old fx-115, still work flawlessly, a testimony to Casio’s build quality. Begin solar driven, I never had to replace a battery. The fx-115 now lives in a kitchen drawer and is used for domestic purposes.

My calculators are  (running :

CASIOFX115familie2

 

 

 

 

Don’t use the provider Llama Communications!

In early June 2005 I got an email from Llama Communications saying there were closing shop because of a bankruptcy. This caused me a lot of work, because domain registrations as well as email and www traffic were coming through Llamacom.

The person running the company,  Michael Grafft in West Des Moines, IA, was very emphatic but said he couldn’t do anything about it.

I switch to a local DNS registrator, Argeweb, and haven’t had any problems since switching. But Michael Grafft lied about Llamacom! They are still in business. Why they forced me out, I don’t know. He never answered my questions why or how things went wrong. So Michael, if you read this, why did you lie to me?

 

 

Don’t use the provider Llama Communications!

In early June 2005 I got an email from Llama Communications saying there were closing shop because of a bankruptcy. This caused me a lot of work, because domain registrations as well as email and www traffic were coming through Llamacom.

The person running the company,  Michael Grafft in West Des Moines, IA, was very emphatic but said he couldn’t do anything about it.

I switch to a local DNS registrator, Argeweb, and haven’t had any problems since switching. But Michael Grafft lied about Llamacom! They are still in business. Why they forced me out, I don’t know. He never answered my questions why or how things went wrong. So Michael, if you read this, why did you lie to me?

 

 

Our energy problem (an old article from 2002)

Introduction to THE energy problem

With 6 billion people demanding ever more energy to live their lives, everybody will sooner or later face problems with their energy supply. Our ‘traditional’ energy sources have a number of problems associated with them. They are finite in size. Also, they cause serious problems with our natural environment. And last but not least, political tensions are very high since these sources are distributed unevenly over the earth, yet we all want access to them.

Oil and gas are running out

One of the closest kept secrets in the oil industry is the knowledge of when the oil wells will run out. It has not yet informed many other people about their knowledge, and when oil executives are asked, they always talk about periods of “50 years or so”.
It has been well documented that the rate at which new oil is found peaked around 1999. Dr. M King Hubbert predicted this scenario already in 1974. This means that even though we will still find new oil, the rate at which we find will decrease. Given that our consumption will increase (China’s recent increase in oil imports is a big factor),  this means that at some point in time the price of oil products will go up. Over the period 2001-2005 an increase of around 40% was observed. This is not likely to abate, and a reverse is out of the question.

Serious environmental problems

We pay a huge price for our addiction to oil. Crude oil is a nasty substance that must be refined to extract the energy stored in it. From the moment the oil is pumped out of the ground to the emissions from the petrol-driven car, oil brings pollution and destruction to this world. Accidents with oil tankers kill our seas and beaches (The Exxon Valdez disaster, for example). Children are born with deficiencies because of car emissions.

A  phenomenon attributed to the usage of oil and other fossil fuels is the warming up of the global atmosphere, the so-called grenhouse effect. Although the result of burning hydrocarbons over decades, it is only lately that we have begun to understand the symptoms and what they mean for our environment.

Political problems created by our oil crave

The current woes in the Middle East are a direct result of our appetite for oil. Our western societies are based on the consumption of fossil fuels that are largely won in this region.  Why this is a tenuous situation can be explained by these points:

  • Our reliance on oil has made us dependent on a region that is our historical counter-pole. Tensions and conflict are running rife as result of this. The muslim world and the western world do not share many beliefs and principles. That is not to say that we must be enemies. However, our dependence on the Middle East is the reason that  the region is a lackey of the west. The current situation is very frustrating for the people of the Middle-East and this results in a growing resentment against us.
  • We support corrupt regimes that do nothing for their people in return for one thing – our guaranteed and uninterrupted access to their oil.  Sometimes this results in serious anger, like the overthrow of the Shah in Iran in 1979. Also, Al Quaeda and Osama Bin Laden tap into this reservoir of resentment. Unless these people think they have their dignity and self esteem back, then this problem won’t go away and it will grow worse and worse. 9/11 2001 was a direct result of this.
  • The instable situation sometimes calls for direct military interventions. The Iran-Iraq war of the 1980s, the first Gulf war to liberate Kuwait and the second Gulf war were all interventions to guarantee a stable supply of oil from the region.

Alternatives for oil

We can rid ourselves of oil if we devote our energy and intellect to a massive transition to other energy sources.

Solar Energy

Solar energy provides an great alternative to oil. The sun radiates enormous amounts of energy and on earth we receive much more than we’ll ever need. For more information,  go to this site.

Wind Energy

Wind energy is a direct offspring of solar energy – the heat of the sun provides for temperature differences which cause winds. The wind is an unlimited and clean energy carrier. In certain regions, where solar energy is not a very rich source due to climatic reasons, wind is an excellent alternative.

Southwest Windpower Whisper 100

Small turbines range in size from 50 Watts to 25 kW, with rotor diameters ranging from 1 to 7 meters. They do not suffer from many of the limitations that the large ones have. For example, if you have 20 small turbines producing the same energy as one large one, the probability that all 20 stop at the same time because the wind  stops blowing is much smaller than the probability that the huge turbine stops. The small turbines can run freely, not impeded by the rule that they must adapt to a grid frequency – they run as fast as is needed. Their electricity output can be converted from AC to DC, to charge a battery or simply be converted back to AC with the proper frequency to feed the grid – local needs can be met. Their site location is not limited to wide open coastal areas or farms: Roofs on inner cities houses are excellent spots for small turbines. And, very important, they do not raise resistance in the public since their placement does not pollute the horizons:  Maximum tower height for a small turbine will be 25 meters, as opposed to the 150m high cathedrals of the electricity companies. 

Opponents of small wind turbines always point out that they are not economical in comparison to the large turbines. One point that is always forgotten in that comparison is that small turbines do not need the huge and costly electricity grid. Not building or maintaining such a network will save a lot of money and this will benefit the users of small turbines. The large turbines cannot function without such a  network and as such need the huge investments for a large electricity network.