story about educational expo in Yerevan

I was able to attend educational expo yesterday. It was my first time I went to Mergelian institute. Eventually, I saw a Kochar’s sculpture. I think they could find a better place for her.
There was an escalator in the building, but only one, for moving up. For other direction there was staircase.

Many pavilions, mostly boring. Upon entering, there was immediately noticeable crowd near Instigate’s pavilion. They were sharing one with Armtab. Armtab took very small space, so the most space was taken by Instigate.

Everything was presented by children. Very enthusiastic, inspired kids. They were telling about their projects. I fired up n900′s FCamera.

Cutter, Linux CNC:
Ինսթիգեյթ, linux cnc

3d printer Bzez A. As far as I get, it’s a RepRap fork:

ռեփռափ, եռաչափ տպիչ, Բզեզ Ա

արաքս ու բզեզ ա

Aghves, the Scratch fork. First went to flash, but Aghves stays with native.

աղուէս, կրիայ

Alas, n900′s battery drained soon, and I have borrowed friend’s galaxy. As you can make sure, quality of photos is not good anymore.

աղուէս, կրիայ

աղուէս, կրիայ

«Berdzor A» and «Aygestan 1» computers՝

«Բերձոր Ա» եւ «Այգեստան 1» կարգիչները

They were designed for Armenian Kashatagh district Berdzor city kids, and Askeran district Aygestan city kids:

Բերձոր Ա տեխնիկական տուեալներ

made in Armenia

այգեստան

Gugark՝

Գուգարք Ա

Kids were telling that they want to suggest Gugark to Ucom, instead of some other hardware they use. They were very inspired when telling about their projects and future improvements

Գուգարք Գ

As you can notice, white balance of galaxy is wrong. This is jpeg, it’s hard to get something from it, excuse me.

On this monitor there were videos shot from copters. In Armenia.

կոպտեր

and the copter itself:

կոպտեր

Alas, there were no Artin & Varoujan pavilion. They have cool boards of local production.
When I was shooting Armtab prototype, they turned it on, so I can see the screen. That was Vostan Desktop Environment.

Արմթաբ, Ոստան

Այ կրակ, այ փետ, այ կնիկ, այ աստուած, այ հեռախօս, ո՞վ է ստեղծել՝

արմթաբ

Very fast about the rest. PhisMath school had a very cool small robot, made by kids. I mean, indeed made by kids. They were talking with each other about their mistakes in PWM programming.

On the contrary, to the Ayb school kids, who never can explain what they have “done”. Instead of that they have very high level of complacent. Yep, it’s Ayb. They had a best pavilion, designed by Storaket. That was a wise decision, to order it from Storaket, they were outstanding mostly because of that. Though, as you may have noticed, I am not a fun of that school.

այբի տաղաւարը, ստորակետի դիզայնը

There was another crowd near the pavilion, when they were showing chemistry experiment. That was good, so that people don’t think that there is only IT nowadays. By the way, their IT was also present – some ugly robots, who can invade the world, if wake up. (: And those robots, I suppose weren’t made by kids.

20140418_143722

At least this one participated Armrobotics competition, I have seen him there, and it wasn’t from Ayb school. tut-tut!

20140418_143743

There were also robots at Quant’s pavilion. But I didn’t want to shoot them, just Lego Mindstorms. I cannot percept Lego as robotics, it’s like spherical robotics in space, not the real one, without many different problems designer can have in real life. And they had this:

20140418_141115_

20140418_141021_

About the rest – many Russian universities advertisements. One – French, Two – German. Near the building girls were giving out advertisements, proudly saying “Russian education”, like that’s a good thing to have. I have returned those papers, and made a mistake. I had to get some more, and put to trash, so less people get it.

This is vulgar girl presenting Rossotrudnichestvo. When I started shooting her, she hastily concealed flowers from the table.

20140418_144954

brrr
20140418_145004

Police. When they noticed that I am shooting, the guy put down the balloon.

ոստիկանութիւն

Art academy pavilion was free. May be that’s a conceptual peace of art:
գեղարուեստի ակադեմիա

Arman:
20140418_144026

Guys presenting AUA gave me a card. There were “Facebook” with large friendly letters, like it’s a Facebook card. It turned out – like us on FB. Okay, and what if I don’t have FB account? Then probably I am not modern. (:

When we were wenting ount, there were a grandfather with granddaughter.
- You will see, dear, what some pupils have done in their schools, what kind of interesting projects…

20140418_144258

photo2014.04.18_13.55.53.77

flashing openmoko gta-02 with leo2moko firmware

There was an announcement in openmoko community mailing list, called First small steps towards free GSM firmware.

I am very pleased to announce that after many years of searching, I have finally found a copy of TI’s firmware deliverable package for their Leonardo development board, i.e., for their Calypso/Iota/Rita chipset reference platform. It is the package which TI must have given to all of their chipset customers including Nokia, Motorola, Compal, FIC/Openmoko, LG, BenQ and many others, and which was used by all of these companies as the starting point for making their unique proprietary firmwares.

The news are, we don’t only have a firmware source, which can be flashed(though it may be illegal in some countries) but we have also completely free and legal loader tools for flashing that firmware. Before, openmoko users had to use proprietary TI tool for that.

So, I decided to try, and here are my notes on how to build and install leo2moko firmware.

Instead of dealing with crosscompilers, I prefer to build the firmware and loader tools right on device. I use SHR distribution on my GTA-02 Openmoko Neo Freerunner.

==install compiler and dev tools on openmoko==

opkg install gcc
opkg install gcc-symlinks
opkg install libc6-dev
opkg install binutils
opkg install make 
opkg install coreutils

It is good to sync time before building:

/etc/init.d/fsotdld restart

or in newer distributions

systemctl restart fsotdld.service

download the flasher source:

wget ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/loadtools-r1.tar.bz2

Unpack

mkdir loadtools
cd loadtools

tar jxvf ../loadtools-r1.tar.bz2

edit makefile, as suggested in readme, set CFLAGS to

CFLAGS= -O2 -march=armv4t -mtune=arm920t -DGTA0x_AP_BUILD

and

EXTRA_OBJ=gtapower.o

then make it

make
make install

these three binaries are now installed in /usr/local/bin

fc-iram fc-loadtool fc-xram

==build firmware==
skip this step if you want to flash already precompiled firmware

unfortunately it’s impossible to build the firmware with free compiler yet, so we need to use windows only tools from TI. Fortunately, tools are possible to run with wine under GNU/Linux box. The environment heavily relies on traditional Unix tools, ported to windows. It would be much easier to deal just with those tools natively.

So, get these files:

ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/leo2moko-r1.tar.xz – the source
ftp://ftp.ifctf.org/pub/GSM/TI_src/wine/installed-env.tar.xz – build tools
wget ftp://ftp.ifctf.org/pub/GSM/TI_src/wine/nowhine.c

gcc -o nowhine nowhine.c
cp nowhine /usr/local/bin

nowhine is a simple utility which strips unnecessary whining messages from whine. you can use it as wine wrapper.

There is a build script, you will find when unpack tarballs. It will run build process and compile the firmware.

==already precompiled firmware==
wget ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/leo2moko-r1-bin.tar.bz2 — already built firmware.

==flashing==

need to kill some daemons running in the openmoko, before flashing:

killall fsodeviced
killall fsoaudiod
killall fsousaged
killall fsodatad
killall fsonetworkd
killall fsogsmd
killall phonefsod
killall phoneuid
killall frameworkd
s3c24xx-gpio b7=0

fc-loadtool -h gta02 /dev/ttySAC0

You should see a bunch of messages followed by a loadtool> prompt.

when you reach that prompt, enter this command:

flash dump2bin my-flashdump.bin

This is a backup of your current calibration data. It may be necessary if something will go wrong with the flash. Transfer it to pc, back it up.

flash erase 0 0x300000
flash program-m0 gsm-fw.m0

quit

reboot

==imei==
This is also very interesting project, on how to read and write gsm device filesystem.
ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/mpffs-tools-r1.tar.bz2

openmoko firmware screenshot

story about slavery

comment from here by marc :

Media is “the old prophet of doom”. Now we have even more aggressive and dangerous ones – usually all of the closed-source, non-free, non-collaborative internet media, social networking sites and news sites. Boycott the hell out of them and they’ll die natural death.

Once it was all about “the tubes”, now it’s about the TRADE. They feed you with their crap, and you’re paying them with your data, your life and your time. However, can we even call it a TRADE, when it’s not even realized by one of the sides of this harmful “transaction”?

Don’t let them fool you.

other comments good too (:

#comment #media #cite #quote #internet #social #trade #slavery #freedom
#քաղվածք #մեկնաբանություն #մեջբերում #համացանց #առեւտուր #ստրկություն #ազատություն

story about Soviet Georgia

I would like to make some quotes from the book I am reading now.

scaled_full_b985fa950328bba494cf

On publishing this book, I did not consider its relevance in today’s current political climate, rather, I naively believed that after the USSR disintegration, the Soviet past of Georgia would become nothing but a bitter memory. I was wrong. As it turned out, the past can come back to haunt you, especially if we ourselves cannot move from it.

The space pioneer superpower failed to produce such a simple piece of clothing as jeans. What can be more innocent than a pair of jeans? But because they couldn’t produce them, they just banned them.
The banned jeans became sweeter than the forbidden fruit.

In those days every pair of jeans was believed to be American, and as the Soviet propaganda was particularly set to destroying American values, many thought the happiness lay where jeans were abundant.
There was a grain of truth in such a belief because the Soviet state denied its citizens the basic civil rights, the right of property among them. One could truly be free only in one’s grave or rather, the authorities stopped worrying about your freedom and rights when you were safely put under the earth…. … There might have been other reasons, but the fact is that a grave was the only property people owed. Such political attitude marked the start of altering Georgian taste for the worse. For centuries, the traditional Georgian graveyards were simple and modest, while in the Soviet times the graves became ovely decorated, adorned with marble tables and benches, statues, bikes and even cars. The Soviet Georgians were confident in one thing only – the grave belonged to them, so they were taken care of and zealosly protected. People built and decorated them as they’d do if they had real estate property. The authorities turned a blind eye to the graveyard eccentricities. The Soviet regime principles didn’t extend to the Georgian graveyards.

The Georgian authorities demonstrated more respect to the dead than to the living. However, there was one prerequisite for a guaranteed grave – one had to die ones’ natural death. If one was executed for crime, the dead convict would certainly be buried but he or she wouldn’t have a proper grave. Starting from 1920s, thousands of executed convicts found their eternal resting place in various unmarked stretches of land across the country. Very often the diggers assigned to the job of preparing a deep hole (not a grave) weren’t able to identify with certainty the places, especially that there were no landmarks to guide them and the work was usually done in the small hours, in complete darkness.

When the men opened the coffin lid, Gega’s mother turned away, waiting for their reaction. The men, deeply stunned, looked at the corpse which was difficult to identify due to the lapsed time. But it was Natia Megrelishvili who said with conviction: ‘This isn’t Gega. This is Soso, it’s his jeans, there’s the sun drawn on them.’ The others looked at the open coffin again and only now discovered the deceased was wearing the jeans, unaffected by the time and the soil. The jeans looked new and there was a shining sun drawn above the right knee.

In the 1960′s and 70′s they didn’t execute professors and scientists anymore, but in return for their lives, they forced them to cooperate with the Soviet authorities. Most of them did cooperate with the government, since otherwise none of them would have been able to travel abroad and attend a single scientific conference. Such cooperation with authorities, at first glance, was nothing special, and sometimes nothing was requested in return for their foreign trips, but this was only at first glance. In reality the main thing was taken away from them – freedom of speech and the right to have their own opinion. They couldn’t express their political views openly and had to support the government in all crucial cases (in every single one, for that matter). That’s what really happened – together with the Soviet government most Soviet scientists obediently created one big Soviet lie. Of course there also were exceptions – those who didn’t want privileges, apartments and cars given by the government (or the government didn’t with to encourage them). But there were very few of them – mostly they sat in the kitchens of their council flats. They would work, eat and drink and express negative opinions regarding the Soviet #regime only there, in the safety of their tiny kitchens. True, some – including academics – were in jail (and not kitchen), but those were known as dissidents.

Thanks to his provincial zeal, in the beginning of the 1970′s, Shevarnadze became the top person in Soviet Georgia (after beating his local competitors) and very soon, very easily, managed to charm the Soviet Georgian intelligentsia. However, the latter was more an “accomplishment” of the Soviet intelligentsia rather than that of the First Secretary, since for dozens of years, the intellectual abilities of the Soviet intelligentsia had also been deteriorating (alongside the morals).

und so weiter

story about left shift

I was tinkering with Ofront, making changes here and there in order to run it on x86_64.
By doing this I met a strange warning issued by gcc when it was compiling Console.c file.

Console.c: In function ‘Console_Int’:
Console.c:57:2: warning: left shift count >= width of type [enabled by default]

So, Console.c is generated from Console.Mod. And the Int function of Console module writes integer to the console.
This is how it looks:

  PROCEDURE Int*(i, n: LONGINT);
    VAR s: ARRAY 32 OF CHAR; i1, k: LONGINT;
  BEGIN
    IF i = SYSTEM.LSH(LONG(LONG(1)), SIZE(LONGINT)*8 - 1) THEN
      IF SIZE(LONGINT) = 8 THEN s := "8085774586302733229"; k := 19
      ELSE s := "8463847412"; k := 10
      END
    ELSE
      i1 := ABS(i);
      s[0] := CHR(i1 MOD 10 + ORD("0")); i1 := i1 DIV 10; k := 1;
      WHILE i1 > 0 DO s[k] := CHR(i1 MOD 10 + ORD("0")); i1 := i1 DIV 10; INC(k) END
    END ;
    IF i < 0 THEN s[k] := "-"; INC(k) END ;
    WHILE n > k DO Char(" "); DEC(n) END ;
    WHILE k > 0 DO  DEC(k); Char(s[k]) END
  END Int;

The error is issued in the line:

    IF i = SYSTEM.LSH(LONG(LONG(1)), SIZE(LONGINT)*8 - 1) THEN

which is translated as following in case of x86_64:

if (i == __LSHL(1, 63, LONGINT)) {

On x86 it gets translated as:

if (i == __LSHL(1, 31, LONGINT)) {

Okay, and it does not issue an error on 32 bit platform, Why?

Probably, need to look into how the _LSHL macro is written. That’s in SYSTEM.h

#define __LSHL(x, n, t) ((t)((unsigned)(x)<<(n)))

Okay, what do we see. It casts the number as unsigned, then shifts it. Obviously, the cast is necessary in order to use the sign bit.

Now let's swerve to the question why do they to do this?
And what special in this "8085774586302733229" number? Or in this: "8463847412"? If you fed this number to the Worlfram alpha saas, it does not give a clue.
The clue gives the lower part of the script, it writes the number from right to left.

WHILE k > 0 DO  DEC(k); Char(s[k]) END

Let's reverse this number and look at it as binary.

noch@SAL9000 ~ $ echo 'obase=2; 2147483648' | bc
10000000000000000000000000000000

wow. This is it. We would get it by shifting 1 to the left.
But why do they shift it?
What is LONGINT on 32 bit platform? It is a number in range from -2^31 .. 2^31 -1.
And the number 2147483648 is 2^31.
So they do it in order to be able to print the number 2^31! Only for that!
Obviously, in case of x86_64 that's the number 9,223,372,036,854,775,808

Okay, let's tinker further. We want to be able to print it, why not?

So why C compiler (I use gcc) does not issue
the warning in case of 32 bits but issues in case of 64?

Because of the macro, probably. Let's write a simple C text to check.

#include "stdio.h"
#define __LSHL(x, n, t) ((t)((unsigned)(x)<<(n)))

int main()
{
   long i;
   printf("%lu\n",sizeof(long));

   i=__LSHL(1, sizeof(long)*8-1, long);

   printf ("%lu\n",i);
return 0;

}

Then,

$ gcc -o test0 test0.c
test0.c: In function ‘main’:
test0.c:9:4: warning: left shift count >= width of type [enabled by default]

The problem is in the cast. If we do (unsigned) then it casts it to unsigned int, not unsigned long.
Let's change the macro to

#define __LSHL(x, n, t) ((t)((unsigned t)(x)<<(n)))

Now it compiles without warnings and run.

$ gcc -o test0 test0.c
$ ./test0
8
9223372036854775808

However, compiler fails to compile it when we make the same change in SYSTEM.h

Console.c: In function ‘Console_Int’:
Console.c:56:11: error: expected ‘)’ before ‘LONGINT’

Why?
Let's emulate the case exactly. We need to add LONGINT typedef

#include "stdio.h"
typedef long LONGINT;
#define __LSHL(x, n, t) ((t)((unsigned t)(x)<<(n)))

int main()
{
   long i;
   printf("%lu\n",sizeof(LONGINT));

   i=__LSHL(1, sizeof(LONGINT)*8-1, LONGINT);

   printf ("%lu\n",i);
return 0;

}

It does not compile!

noch@SAL9000 /tmp $ gcc -o test1 test1.c
test1.c: In function ‘main’:
test1.c:10:6: error: expected ‘)’ before ‘LONGINT’

We clearly see that in the macro there are three arguments which _LSHL expects but for some strange reason gcc expects the closing parentheses after the second argument.
However we can compile it with g++ - it understands this typedef issue

noch@SAL9000 /tmp $ cp test1.c test1.cpp
noch@SAL9000 /tmp $ g++ -o test1 test1.cpp
noch@SAL9000 /tmp $ ./test1
8
9223372036854775808
noch@SAL9000 /tmp $

Okay. What can be done here?
We can do

typedef unsigned long ULONGINT;

and then change macro like this:

#define __LSHL(x, n, t) ((t)((ULONGINT)(x)<<(n)))

So the file looks like

#include "stdio.h"
typedef long LONGINT;
typedef unsigned long ULONGINT;
#define __LSHL(x, n, t) ((t)((ULONGINT)(x)<<(n)))
//#define __LSHL(x, n, t) ((t)((unsigned t)(x)<<(n)))

int main()
{
   long i;
   printf("%lu\n",sizeof(LONGINT));

   i=__LSHL(1, sizeof(LONGINT)*8-1, LONGINT);

   printf ("%lu\n",i);
return 0;

}

now, and it compiles

$ gcc -o test test.c
$ ./test
8
9223372036854775808

But this is not what we want.
The good solution would be to replace a macro with a function, which can be debugged, and which won't give such an error. But it is not possible to pass a type as an argument in plain C without a macro. It may be possible by using templates, in C++, but we use C.
May be there is a need to change Ofront in a way it would generate a different function call.
Another solution is to use define instead of typedef.

#include "stdio.h"
//typedef long LONGINT;
#define LONGINT long

//typedef unsigned long ULONGINT;
//#define __LSHL(x, n, t) ((t)((ULONGINT)(x)<<(n)))
#define __LSHL(x, n, t) ((t)((unsigned t)(x)<<(n)))

int main()
{
   long i;
   printf("%lu\n",sizeof(LONGINT));

   i=__LSHL(1, sizeof(LONGINT)*8-1, LONGINT);

   printf ("%lu\n",i);
return 0;

}

Test runs

$ gcc -o test test.c
$ ./test
8
9223372036854775808

For now the solution is to replace typedef with define in SYSTEM.h and use (unsigned t) cast in the macro.

und so weiter

story about one death

657996CC-5DC6-423E-BB5C-C7B1B1CA0B96_w443_r1

Today, many years ago a dictator named Stalin died.

As House once said, almost dying changes nothing. Dying changes everything.

So this allowed us to stop devastation of the Sevan lake, it allowed us to free some political prisoners, such as Mahari (though it was too late to help Charents), it allowed us to get rid of the huge Stalin monument over the Yerevan,
monument-to-stalin---yerevan---1962

it allowed us to have our 60ies, to speak about armenian genocide, and build a memorial where we can bring flowers and not be arrested, to have new, interesting architecture, like openhall, or a seagull for which Khrushchev punished Zarobian, it allowed us to breath a little more free, fresh air, it allowed some short change.
When it is someone’s birthday, people say – how cool that you’d born, and when people like Stalin die, it’s time to say – how cool that you died, thank you for that, it’s possibly the best thing you could do, and it was very nice for Armenia.

openhall

ruben17-1

seagull

und so weiter

story about smell of money

spent several months programming in Java. Contrary to its authors prediction, it did not grow on me. I did not find any new insights – for the first time in my life programming in a new language did not bring me new insights. It keeps all the stuff that I never use in C++ – inheritance, virtuals – OO gook – and removes the stuff that I find useful. It might be successful – after all, MS DOS was – and it might be a profitable thing for all your readers to learn Java, but it has no intellectual value whatsoever. Look at their implementation of hash tables. Look at the sorting routines that come with their “cool” sorting applet. Try to use AWT. The best way to judge a language is to look at the code written by its proponents. “Radix enim omnium malorum est cupiditas” – and Java is clearly an example of a money oriented programming (MOP). As the chief proponent of Java at SGI told me: “Alex, you have to go where the money is.” But I do not particularly want to go where the money is – it usually does not smell nice there.

source

und so weiter

story about pencil marks

I have eventually found this book, second hand, obviously.

I have learned about it first because Creenshaw in his compiler book advised it as one of the best compiler books ever.

POINTER TO syntax appeared first in Modula.
Apparently the former owner of the book tried to translate the text from Pascal to Modula, or may be to Oberon.


There is no BEGIN in WHILE loops since Modula.
Modula and Oberon also don’t have the FUNCTION keyword, they have only PROCEDUREs (:

und so weiter

quote about debugging

from Wirth’s interview

well, of course, if the world was ideal I would gladly recommend learn the basic concepts properly and then do programming with Oberon. But I’m fully aware that the world is not that simple. Programmers nowadays are faced with very difficult task and they cannot afford to build system from scratch. They have to use many tools that exist already and interface their new programs with them, and that’s where the problem is. This interface is not even properly and fully specified. Any many work comes with that. It is quite well known that if 5% percent going to programming is much, the rest is going to debugging. And that’s precular, it’s not science, not even engineering, it’s just trying.

und so weiter

quote about old design

The libc is certainly not a good guide:

* Buffer overruns are not ruled out by design: gets, sscanf etc.
* Interface inconsistencies: gets vs fgets, fgets vs fscanf (note
the position of the file stream parameter)
* Bad interfaces like that of getchar() whose return code
can be a character or an error code
* Particularly bad buffering system which
– ignores the block structure of underlying file systems, and
– does not support bidirectional buffering
* No provisions exist such that independent libraries can cooperate
with each other in
– signal handling,
– setting up alarms, and
– tracking childs.

(Please note that I do not want to bash Ritchie, Kernighan etc. The
libc is history and should be taken as such… It is time to abandon
C and the libc and it does not help to place other systems on top of this historic relic.)

source
und so weiter