The Guardian newspaper published the password to the unredacted Wikileaks cables in a book

Don't take my word for it, take a look for youself:

And what does The Guardian have to say about Wikileaks subsequent and wholly redundant release of the unredacted cables:

The move has been strongly condemned by the five previous media partners – the Guardian, New York Times, El Pais, Der Spiegel and Le Monde – who have worked with WikiLeaks publishing carefully selected and redacted documents.

"We deplore the decision of WikiLeaks to publish the unredacted state department cables, which may put sources at risk," the organisations said in a joint statement. [1]

Can mendacity be any more transparent than this?

My own point to life

Life itself, in as much sense as it makes to refer to it in the third person and ascribe an objective to it, has no objective other than to propagate itself and continue to act accordingly to the will of physics and biology.

In life, the fittest individuals prevail against the weaker, and it is that both the fit and the weak are necessary to the process. Against this observation, the only personal objective to bare nature's rubber stamp is for a person to be and behave exactly as nature intended them to. So rest assured, nature loves you for whom you are. At the very least we all share this purpose, and life should always have meaning in this sense.

Humans however, are singularly privileged in the animal kingdom in having the capacity to reflect on themselves and the process within which they prosper or flounder. We can ascribe our own meanings to life and invent our own point to it. Thus I have invented my own point to life by rationalizing what I want out of it, and so without further ado, I declare that:

The point of life is to make yourself happy and to make others happy.

Intrasite Scheduling for Interference Avoidance in LTE

If you didn't know, I work for Vodafone R&D. I did my EngD there too. I wrote this paper a couple of months ago toward the end of my program:

Ashley Mills, David Lister: Intrasite Scheduling for Interference Avoidance in LTE In Proceedings of the IEEE 73rd Vehicular Techonology Conference, IEEE VTC2011-Spring, 2011, Budapest, Hungary. (c) 2011 IEEE

It is about leveraging intrasite knowledge to improve scheduling performance in LTE... as the title says.

Arduino and GCC, compiling and uploading programs using only makefiles

Using the Arduino IDE or the Antipasto IDE can be limiting for serious development owing to their design being focused for computer newbies, abstracting away what is going on under the hood. This is especially pertinent when using the Antipasto IDE, for boards like the Liquidware Touchshield Slide, because the IDE does not by default appear to support the adding of custom .cpp and .c files to the .pde source directory, forcing the use of a single .pde file, which is ridiculous. Furthermore, both IDEs force the user to stick the PDE in a directory of the same name. Perhaps there are some workarounds for these issues, but since I'm too lazy to RTFM I decided to write a makefile to compile and upload AVR programs to boards such as the Arduino.

This example will consider the Arduino Uno since this is a popular board. It will demonstrate how to create a static library using the Arduino source, which can be called upon to compile and upload custom c and c++ programs to the Arduino Uno. It is straightforward to modify this example for other boards, including the Mega1280 and the Touchshield Slide (I have done both). This explanation is written for FreeBSD and Linux users, similar steps can probably followed on Windows using win-avr and cygwin.

The first step in building an Arduino library is to obtain the src files for the Arduino board. You can get these from git, or from your own system if you've already installed the IDE (They'll be somewhere like /usr/local/arduino/hardware/cores/arduino/src/components/board). However they are obtained, put the src files into a directory of your choice. Alternatively you can save yourself the hassle and download this complete tutorial in a gzipped tar: arduino_gcc_tutorial.tar.gz

I'm going to assume arbitrarily, that you want to put headers in ~/include/arduino and the Arduino library in ~/lib, but of course you can put these wherever you want.

Since avr-libc does not implement the C++ new and delete operators, these shall be defined by us for convenience in two additional files: forward.h and forward.cpp.

  1. forward.h
    #pragma once
    extern "C" void __cxa_pure_virtual(void);
    __extension__ typedef int __guard __attribute__((mode (__DI__)));
    extern "C" int __cxa_guard_acquire(__guard *g);
    extern "C" void __cxa_guard_release (__guard *g);
    extern "C" void __cxa_guard_abort (__guard *g);

  2. forward.cpp
    #include "forward.h"
    void __cxa_pure_virtual(void) {}
    int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);};
    void __cxa_guard_release (__guard *g) {*(char *)g = 1;};
    void __cxa_guard_abort (__guard *g) {};

These should be placed in the same directory as the Arduino src so the listing looks like this:

binary.h        HardwareSerial.cpp  Print.cpp    Tone.cpp          WInterrupts.c   wiring_digital.c
wiring_pulse.c  WProgram.h          forward.cpp  HardwareSerial.h  pins_arduino.c  Print.h    
WCharacter.h    wiring_analog.c     wiring.h     wiring_shift.c    WString.cpp     forward.h
main.cpp        pins_arduino.h      Stream.h     WConstants.h      wiring.c        wiring_private.h
WMath.cpp       WString.h

Now for the Makefile. I'm using GNU make for no specific reason. On FreeBSD when installed this will be called "gmake", as BSD already has its own make. So you'll have to type this unless you alias it. Since most Linux distros use the GNU tools, it's likely that on a Linux box you can just type "make". Here is the Makefile:

CC=avr-gcc
CXX=avr-g++
MCU=-mmcu=atmega328p
CPU_SPEED=-DF_CPU=16000000UL
CFLAGS=$(MCU) $(CPU_SPEED) -Os -w
BOARD=arduino
LIBNAME=lib$(BOARD).a
INCDIR=~/include/$(BOARD)

OBJECTS=pins_arduino.o wiring.o wiring_analog.o wiring_digital.o \
        wiring_pulse.o wiring_shift.o HardwareSerial.o Print.o   \
        Tone.o WMath.o WString.o WInterrupts.o forward.o

default: $(OBJECTS)
   avr-ar rcs $(LIBNAME) $^
   mkdir -p $(INCDIR)
   mkdir -p ~/lib/
   cp *.h $(INCDIR)/
   mv $(LIBNAME) ~/lib/
   rm *.o

%.o : %.c
   $(CC) $< $(CFLAGS) -c -o $@

%.o : %.cpp
   $(CXX) $< $(CFLAGS) -c -o $@

When the make (or gmake) command is executed from the shell in the src directory the target named default is called. Now the default target depends on OBJECTS, which are all the object files required to build the Arduino library. These objects correspond to all the .c and .cpp files (except main.cpp which is no longer needed by us). Since default depends on these objects, and they do not presently exist, gmake tries to create them and looks for rules to create them. The rules which match are:

%.o : %.c
   $(CC) $< $(CFLAGS) -c -o $@

%.o : %.cpp
   $(CXX) $< $(CFLAGS) -c -o $@

These are very similar to rules implicity defined by gmake, but they have been modified slightly. They are simple rules to create object files from .c and .cpp files respectively. To take the first rule as an example, it says: in order to create a %.o target, where % is a wildcard, check for a corresponding %.c dependency and perform the action specified on the following line. In this case, the action defined invokes the avr-gcc compiler upon the automatic variable $<, which denotes the first dependency. For example, when the target wiring.o is substituted for %.o, the corresponding %.c is wiring.c. This is also the first dependency and so substitutes $< as an argument to avr-gcc.

CFLAGS specifies the compiler flags, and is defined at the top of the Makefile:

MCU=-mmcu=atmega328p
CPU_SPEED=-DF_CPU=16000000UL
CFLAGS=$(MCU) $(CPU_SPEED) -Os -w

The microcontroller (MCU) is specified with the -mmcu flag, and the CPU speed set to 16Mhz. The correct flags to use for a given Atmel MCU can be obtained by reading the manufacturers specification or by consulting Arduino's boards.txt.

The flag -Os specifies that generated code should be optimised for size, note that speed optimisations are also performed upto gcc's level 2 so long as they don't typically increase code size. The -w flag suppresses warnings (which I don't care about). The final flag which appears in the rule is -c, which tells avr-gcc not to link the object file. And finally, going back to the action line, -o specifies the desired name of the generated object file. In this case $@ is used, which is another automatic variable which matches the file name of the target of the rule, i.e the object file matched, for example wiring.o.

gmake will perform this process for all objects specified, using the second rule for C++ files, the only difference being that avr-g++ is used instead of avr-gcc. Once all the objects are created, the default rule continues as follows:

default: $(OBJECTS)
   avr-ar rcs $(LIBNAME) $^
   mkdir -p $(INCDIR)
   mkdir -p ~/lib/
   cp *.h $(INCDIR)/
   mv $(LIBNAME) ~/lib/
   rm *.o

The avr-ar line creates an archive named LIBNAME containing all the object files matched by the automatic variable $^. This automatic variable matches all of the rule dependencies, i.e the variable OBJECTS in this case. The next two instructions make the directories: ~/include/arduino and ~/lib. The forth instruction copies all the header files into ~/include/arduino so that they can be referenced later. The fifth instruction copies the generated archive libarduino.a into ~/lib so it can be used later. The final instruction deletes the generated object files which are no longer needed once the archive has been constructed. The library has now been constructed and is ready to use.

To build a library for another target board, such as the Arduino Mega only the MCU and processor speed need to be changed accordingly.

Now that the library has been constructed, it is time to demonstrate how to link it against a real program, capable of being uploaded to the Arduino. Consider the following trivial example:

#include "WProgram.h"
void setup() {
   pinMode(13,OUTPUT);
}

void loop() {
   digitalWrite(13,HIGH);
   delay(100);
   digitalWrite(13,LOW);
   delay(100);
}

int main() {
   init();
   setup();
   while(1)
      loop();
}

Notice that the usual Arduino setup() and loop() functions have been maintained for convenience, but the real work is now being done by the main function familiar to any programmers of c or C++. The header file WProgram.h is needed to reference the Arduino function such as pinMode(13,OUTPUT) or whatever. The function init is needed by wiring.c in its setup. The main function can be reused like that and so there is very little difference between a .pde and a file like this. This program flashes the LED on pin 13 like the classic blink.pde example sketch that comes with the Arduino. To compile program, link it to the library created before, and upload it to the Arduino, the following makefile can be used:

CXX=avr-gcc
INCLUDE=-I ~/include/arduino/
LIBS=-L ~/lib -lm -larduino
MCU=-mmcu=atmega328p
CPU_SPEED=-DF_CPU=16000000UL
CFLAGS=$(MCU) $(CPU_SPEED) -Os -w -Wl,--gc-sections -ffunction-sections -fdata-sections
PORT=/dev/cuaU0 # FreeBSD
ifeq ($(shell uname),Linux)
   PORT=/dev/ttyACM0
endif

default: build upload

build: Test.hex

Test.hex: Test.elf
   avr-objcopy -O ihex $< $@

OBJS= # Put other objects here
Test.elf: Test.cpp $(OBJS)
   $(CXX) $(CFLAGS) $(INCLUDE) $^ -o $@ $(LIBS)

upload:
   avrdude -V -F -p m328p -c arduino -b 115200 -Uflash:w:Test.hex -P$(PORT)

clean:
   @echo -n Cleaning ...
   $(shell rm Test.elf 2> /dev/null)
   $(shell rm Test.hex 2> /dev/null)
   $(shell rm *.o 2> /dev/null)
   @echo " done"

%.o: %.cpp
   $(CXX) $< $(CFLAGS) $(INCLUDE) -c -o $@

This time the default target depends on the build and upload targets, which means these will be called in turn. The build target depends on the file Test.hex. This is the hex file which will be uploaded to the Arduino over the USB to serial interface. This target depends on Test.elf, which is the actual gcc compiled object file. The target Test.elf, depends on Test.cpp and any other objects specified in the variable OBJECTS.

Objects specified in the OBJECTS variable will be compiled by the rule:

%.o: %.cpp
   $(CXX) $< $(CFLAGS) $(INCLUDE) -c -o $@

Which is very similar to before. Once all objects are compiled, Test.elf is compiled using the rule:

Test.elf: Test.cpp $(OBJS)
   $(CXX) $(CFLAGS) $(INCLUDE) $^ -o $@ $(LIBS)

There are a few differences to the gmake rule described previously. First all the dependencies are pulled in using the automatic variable $^ since there can be multiple inputs. And secondly the -c flag is NOT specified since it is desired to link the compiled executable to the dependent libraries. The compiler generates the compiled code and then tries to find any functions used. The places to look is specified using the flag -larduino, which causes the compiler to search for a library called libarduino.a. More generally, in this context, -lX causes the compiler to search for libX.a. The compiler searches for libarduino.a in several default locations as well as any specified using instances of the -L option, which in this case is set to ~/lib, which is the directory the library was stored in earlier. Finally, observe that the CFLAGS variable is different:

CFLAGS=$(MCU) $(CPU_SPEED) -Os -w -Wl,--gc-sections -ffunction-sections -fdata-sections

The only difference is the addition of a few new flags:

  • -Wl,--gc-sections This cuts out .o files which are not used.
  • -ffunction-sections This makes it seem to the linker essentially as if each function were in its own .o file, so that --gc-sections argument is even better.
  • -ffdata-sections This does for static and global variables what --ffunction-sections does for functions.

Once the Test.elf this rule is done, and the dependency for the Test.hex rule is satisfied, so it executes:

Test.hex: Test.elf
   avr-objcopy -O ihex $< $@

This straightforward rule invokes avr-objcopy to convert Test.elf into a format that can be recognised by the Arduino's bootloader (which accepts new programs via the USB to serial interface). The flag -o IHEX specifies the intel hexadecimal format accordingly. Note that there are several options available to avr-objcopy which are claimed to reduce hex file size, which can be useful since these boards don't have a lot of FLASH. I tried a few but it didn't seem to make any difference, so I haven't bothered with them. That's the build target finished, which means that make goes onto the upload target.

The upload target flashes the hex file Test.hex to the Arduino using avrdude:

upload:
   avrdude -V -F -p m328p -c arduino -b 115200 -Uflash:w:Test.hex -P$(PORT)

The flags are as follows

  • -V Disables automatic verify check upon uploading. Roughly halves the upload time, since the serial interface is used to re-read the uploaded program for verification.
  • -F Do not try to verify the device signature. They say the sig can get overwritten, hasn't happened to me, but we know what the device is anyway so who cares.
  • -p m328p Specifies the MCU, in this case ATmega328P, see the manpage for a list.
  • -c arduino Programmer ID, specifies the pin configuration for use in serial communication with the Arduino.
  • -b 115200 The serial baud rate (symbols per second) to use when communicating with the Arduino.
  • -Uflash:w:Test.hex This says to perform a memory operation (-U) on the flash memory of the Arduin and specifically perform a write operation (w) with the file Test.hex
  • -P$(PORT) This specifies the serial port to use to communicate with the Arduino.

Most of the values from these options I obtained from boards.txt but one could also refer to the MCU manufacturers specifications. Notice that I've also included some code to choose the port based on platform (only FreeBSD and Linux):

PORT=/dev/cuaU0 # FreeBSD
ifeq ($(shell uname),Linux)
   PORT=/dev/ttyACM0
endif

Different boards require different options, and FTDI devices can appear on a different port such as /dev/ttyUSB0. But you should easily be able to figure out how to work with any of the common boards given this framework, so I'll leave the generalisation as an exercise for the reader... (or in otherwords, I'm too lazy since I don't need it for my purposes). Incidentally, laziness gets you everywhere in programming. Whilst one cannot be so lazy so as to do nothing, having taken up the challenge, the lazy programmer takes the most efficient and direct path to completion. The lazy programmer also produces speedy code, because he cannot be bothered to wait long for his programs to start, and he hates waiting for them to finish doing their jobs.

Arduino Mega (ATmega1280) + Adafruit Datalogger Shield

You may have seen briefly a couple of days ago that I posted something about the Seeduino Stalker V1.0, about how to get the RTC working. Well, the solution doesn't seem to work now, so I deleted the post, and I'm just going to get a refund on the board. I've given it enough of my time and I can't be bothered with that bullshit.

Anyway, I have another board for datalogging, which is the Adafruit Industries Data-Logger Shield. This is designed for the Arduino, but as I'm lending my Arduino Uno to someone, I had to use an Arduino Mega (ATmega1280) which was conveniently lying around.

Unfortunately the SPI pins and the I2C pins are in different places on each board.

I saw something in a forum about using software SPI, but I prefer using the hardware wherever possible. Looking at the layout for the SPI on both boards:



You should be able to see that all you need to do is wire the following from the Data-Logger Shield to the Mega:

10 ~> 53
11 ~> 51
12 ~> 50
13 ~> 52

And wire the SDA/SCL pins 4 and 5 on the Data-Logger Shield to pins 20 and 21 on the Mega, respectively. And by "wire" I mean just literally make a connection between the respective pins using a jumper wire.



When you program, be sure to use pin 53 instead of pin 10 for the SD interface, for example:

pinMode(53, OUTPUT);
SD.begin(53);

Note, pins 10,11,12,13,4, and 5 on the Mega are usable, but one would need to find a way to access them, as they are currently blocked by the Data-Logger in the configuration above.

MYTH 2: Drugs create a false happiness! They turn you into a different person.

On the subject of drugs, we might add another argument. A classic refutation is that drugs create a kind of "false" happiness. This is again bullshit, perpetuated by the depressed mind to keep itself imprisoned.

First of all, nobody said that anti-depressants make you "happy''. Are non-depressed people constantly happy? No. What the drugs intend to do is make you normal again. You wouldn't expect a cure for cancer to return a person to some kind of super-human level of health, beyond that which they ever had? Would you? It may be the case that drugs can make you more happy than a non-depressed individual, or that cures for cancer can make people even better than they were before, but this is beside the point.

Let us consider the refutation seriously. The brain is full of receptors for drugs. How we feel is mediated by drugs that the brain produces. Dopamine, serotonin, acetylcholine, etc etc. This is pretty fucking obvious to anyone that has studied basic biology, or failing that, drank a caffinated or alcoholic drink.

Now, when you spy your eyes over at non-depressed people being happy, do you think that they are being "false happy"? Probably not, for if you do, then why would you object to taking drugs to make yourself "false happy"? No, presumably, you think they are happy in a way that is acceptable to society. A kind of "true" happy, or "good" happy. Well in that case, think a little bit about how else they behave.

Isn't it a little suspicious that none of these non-depressed types sit around ruminating about suicide and melancholic aspects of reality all the time? Isn't this a just a little bit suspicious and curious? Could it be, or perhaps you don't want to allow yourself to think this, but isn't it more likely that you are already in a false state of mind by virtue of your depression? Isn't it more likely that depression itself is the "false" state?

Anti-depressants move your brain away from one state and take it to another. From my experience taking anti-depressants, I do not believe that they create a false kind of happiness. But even if they did, it would be completely bonkers to prefer being depressed, especially since you are not expected to take these drugs forever. The ultimate aim being that your brain state returns to normal over time. In fact if you think about it, why would you object to being "false happy" even if it were true that drugs caused this? What would be so bad about temporarily being in a "false" state as part of treatment for a disease?

If you smash your leg into pieces in a horiffic car accident, chances are the hospital will give you morphine for the pain until the body heals and the pain subsides. Not being able to feel pain is about as "false" a brain state as you can get. Now, would you, finding yourself in that situation, refuse treatment, and force yourself to feel excrutiating pain instead? Would you afflict the same fate upon your friends, your family, or your own children? I doubt it. So why do the same to yourself? "Natural" or not, taking medicine to overcome disease is an ordinary everyday occurance.

Depression is a diseased state of mind, in the same way that auto-immune disorders are a diseased state of the body. You wouldn't accuse someone with an auto-immune disorder of betraying their true self for taking drugs to counteract it. And the same is true for any disease or affliction, including depression.

Depression is a real disease, just like cancer, or motorneurone disorder, or parkinsons, or anything else. Refusing to take drugs out of some misplaced loyalty to your depressed state of mind and your false belief of its "naturalness", is tantamount to refusing to undertake kemotheraphy for some kind of love of your tumours.

You might reject kemo because of the side effects, but to reject it because you think tumours are your true self, would be absolutely barking.

MYTH 1: I don't want to take drugs because it would be weak to do so. I shouldn't need them to get better.

This is a classic. Whilst there are legitimate reasons to avoid taking drugs, such as side effects, I am talking here about the specific excuses given by depressed people to prevent themselves from getting better.

Under this peculiar reasoning, drugs are seen as synonymous with being defeated, are chided as being unnatural, and are at odds with the "real them" etc etc.

But what I want you to see is how obsurd this position actually is.

Consider the number of people who depend on prescription glasses. This is not a small number of people as you are clearly aware. Now tell me, how often do you hear them saying the following to themselves:

"Oh, I'm such a waste of space, look, my stupid eyes, I'm biologically deficient, defective. I have to wear these manmade artifacts, manmade dammit! How unnatural. I depend on these things for my survival. I'm a dependent slave of the glasses. I'll have to keep wearing these for the rest of my life! It isn't the real me!"

Now do they say that in general? Or do they just get prescribed glasses and get on with their lives?

Of course they don't fucking say that. Only a depressed person wearing glasses would think like that! You can bet that 95% of all people that wear glasses have never even thought about their "dependency" in this way at all. I bet it never even occurred to most of them that life would be incredibly different for them if they went back a few thousand years.

And you know why they haven't? Because it is completely irrelevent, opticians exist, and it is easy to get hold of glasses. Whilst wearing them is a little inconvenient, these people can get on with their lives pretty much as well as anyone else.

So why should being "dependent" on drugs be any different? They are easy to get and for all practical purposes, unlimited in supply. I can imagine your brain reeling in opposition to this statement, trying to find an escape route from this reasoning. Some excuse as to why this "isn't the same". Well let me tell you, abstractly the positions are fucking identical!

Depression is a physiological problem, all the pychological correlates which symptomise and corroborate to perpetuate the problem, are fundamentally simply manifestations of underlying physiological differences.

Perhaps you are yet to be convinced of my glasses argument? Well luckily, glasses are just the tip of the iceberg.

There is not a single person on this planet that is not dependent on something else on the planet. We all have to eat, afterall. It is incredibly arrogant to believe that you are somehow independent of the rest of the world.

We have to be innoculated with manmade vaccines against terrible diseases, and we take anti-biotics when we are sick. We need mothers and fathers, friends and associates. We depend on electricity, on refrigeration, on communications, on the police and the firebrigade. To see any of these dependencies as weakness of the self, is ludicrious. Sorry to break it to you, but we do not have dominion over everything else on the planet. We need each other, and we need society.

I've laboured the point hard enough. There is nobody on this planet who does not depend on a myriad of manmade things and medicines to continue existing. Even remote tribes depend on each other and their accumulated knowledge. So why single out certain types of drugs, namely antidepressents, as a "bad" dependency? I wonder, is it possible that the brain is trying to stop itself from getting better? Like the institutionalized prisoner, perhaps he feels he can no longer leave the prison. Do you want to leave your prison?

If you still believe that taking drugs is somehow different to the other kinds of "dependency" I've given, then you need to think about it more! If you do the logical reasoning, you will not be able to avoid coming to the conclusion that in all ways that matter to the depressed person, the pheonomena are identical.

So please, don't waste anymore time thinking up ways to avoid taking drugs. If you are depressed and in need of treatment, take the drugs and ignore the bullshit.

And let me say this to finish off. Sometimes a person's family, friends, associates, or just people whose business it is nothing of, will say things that reinforce the myth that antidepressants are somehow worse than all the other kinds of things we need. Ignore these people, they don't have a fucking clue what they are talking about. They are like the Jehovah's witnesses telling people that they shouldn't have a blood transfusion when they are lying on an operating table dying. They are recklessly misinformed.

Take the drugs anyway.

Smashing Depression for Fun and Profit

Depressed people are prisoners of their own minds. They construct their prisons, and furnish them with all kinds of security features designed to keep themselves locked in.

This is not to say that depressed people are to blame for their predicaments; far from it. Their constructions are most likely an involuntary response induced by certain environmental stimuli or genetic factors, over which the depressed person initially has no control.

Indeed, to begin with the prison is like an open prison, and only gradually increases to a maximum security one over time. The transformation occurs in such subtle ways, that it is very difficult for the depressed person to notice that it is happening, and by the time they come to the realisation that it is, they open their eyes to Alcatraz.

The person then continues to maintain a kind of contradictory state of being, in which the person wants to alleviate their own suffering, but somehow partakes in its perpetuation and maintainence. Again, they are not to blame for this, since to begin with, this is done involuntarily.

At some point however, it will dawn upon them, that something odd is going on. That they are behaving in a manner they do not want to. That their mind is complicit in its own destruction. It is at this point that their will must come to bear on the problem, and the ball enters their court for the first time in their disease. With reflection and awareness, the person can learn to identify the little, and not so little, tricks that are going on and try to avoid them.

Why would the mind do this to itself you might be wondering? Nobody really knows at the moment so we can speculate: perhaps the prison is initially setup for protection from the outside world but the constructive mechanism self perpetuates and goes awry; perhaps it is a kind of memetic virus that once seeded grows into a monster, or perhaps it is a self-enforcing wiring problem in the physiology of the brain. Perhaps one of these was trigerred by a traumatic childhood event or from spending too long in a warzone, or perhaps you ended up like this for the same reason you have blue eyes.

Whilst the causes do actually matter, and their understanding will lead to better treatments, for the moment we have to address ourselves to the present situation, and within the extant knowledge of science. So I'm going to propose that we don't actually give a shit what causes it, unless that somehow helps us to overcome it. In this book, I therefore focus on trying to address the problem once it has already manifested. In this vain I would like to try and attack some of the points at which a depressed person might try to cling on to their captor. Let's prise your fingers off the bottle. We shall call this process "Smashing Depression for Fun and Profit".

Arduino on Arch Linux

I've gotten into Arduino programming these days. The Arduino Uno is a great little board with an ATMega328p chip:

My first project is a cat monitoring device, more about that when I make some progress. Since my favourite laptop is running Arch Linux, I tried to setup the Arduino IDE on it. If you do this, you will discover that it won't work. Well never fear because there is a better way anyway.

Install scons and use this scons script: http://code.google.com/p/arscons/.

Copy the SConstruct file into the same directory as your sketch and type "scons" to compile it.

The scons documentation says that you can type "scons upload" to upload the compiled sketch to the Arduino but I got errors that I couldn't be bothered to resolve (I'm lazy). So I considered fuckit and just used avrdude directly by examining what the IDE does:

avrdude -F -V -c arduino -p m328p -P /dev/ttyACM0 -U flash:w:file.hex

"-F" disables the device signature check. Actually I don't think this is needed. If you set the programmer-id to "stk500v1" (like the IDE does) then it is needed because the device signature appears as 0x0 instead of "1E 95 0F". But when you use programmer-id "arduino", on my device at least, the device signature is correct... you decide.

"-V" disables post-upload code verification. This speeds things up a little.

"-c" specifies the programmer-id which is the pin configuration to use with communication with the board, in this case "arduino".

"-p" specifies the microcontroller, in my case ATMega328p, which is abbreviated "m328p".

"-P" specifies the port that the arduino is connected to, in this case "/dev/ttyACM0"

"-U" is followed by the memory command to perform, in this case we say to target the flash rom "flash", and to perform a write operation "w", using the HEX file "file.hex". This is generated by scons and takes the name of the sketch.

This command works on my machine here, and mitigates having to use the broken package and IDE. For simplicity, I put the scons and avrdude lines in a Makefile:

default:
	scons
	avrdude -F -V -c arduino -p m328p -P /dev/ttyACM0 -U flash:w:blink.hex 

so I can just type "make" at the CLI. Hope this helps. Cheers.

EDIT: Forget scons, I wrote a tutorial about using GCC directly with makefiles: here.

Arch Linux

I had to drop FreeBSD for now on my Acer TravelMate 2300. I'm still using it on my desktop machine.

The reason for dropping it on the laptop is that the intel drivers freezes up the system under Xorg 7.5 , as discussed here. Now, I'm not going to use VESA. Newer drivers are available, but are waiting for KMS support. The only way to live with the problem is to keep Xorg at version 7.4, but this is a hassle given that I like to track the current version of FreeBSD. Sure one can keep Xorg at the old version even with the new FreeBSD, but it is a headache.

So, I decided to switch to try out Arch Linux.

It's my new favourite because:

  • It's fast.
  • It has a good package manager.
  • It has up-to-date packages.
  • It has a good philosophy

That didn't really need a list. What can you really say about these things, there are so many distros. I just like the feel of this one, and it is fast for sure.

I'm using xfce4, and I really like it.

Syndicate content