Monthly Archives: January 2012

Microchip anounces new cross-platform MPLAB XC compilers

Microchip has announced that it will release new cross-platform MPLAB XC C compilers by the end of March. They come in 3 versions depending on PIC family: XC8 is for 8bit, XC16 for 16bit, and XC32 for 32bit microcontrollers.

Microchip is releasing MPLAB XC C compilers in the upcoming weeks. There will be three, one for each of the major Microchip logic architectures: MPLAB XC8, MPLAB XC16 and MPLAB XC32. By the end of March, we should have all three versions available. In the same open-platform spirit as MPLAB X IDE, MPLAB XC C Compilers will run on Windows, MAC and Linux. XC compilers will come with a new license manager to make installation and license management simple across platforms. Users will be able to install the compiler on any platform of choice.

Esto ya se venía viendo desde un tiempo atrás, cuando la gente de Microchip empezó a unificar varios aspectos del compilador Hitech, para hacerlo mas “parecido” al MPLAB C18.

Personalmente me parece una excelente decisión de parte de Microchip, ya que actualmente existen tres compiladores “oficiales” de microchip para la gama de 8 bits (Hitech for PIC10/12/16, Hitech for PIC18 y MPLAB C18).

Unificar estos tres facilitará enormemente la programación a los usuarios además de proveer mayor facilidad de portabilidad de código y librerías existentes entre los diferentes modelos de microcontroladores de 8 bits de Microchip.

Disabling Discrete GPU in Debian GNU/Linux Wheezy

I really like using GNU/Linux, especially Debian distributions (not Debian-based, just Debian). I was doing just fine until I bought a HP Pavilion dv7-4285dx laptop a few moths ago. It has a Intel Core i5 460 CPU, 6 GB of RAM and 640 GB HDD, another interesting feature is the switchable graphics system, that means, it has an integrated Intel GPU for low power / low performance and a discrete ATI Mobility Radeon HD6370 GPU for high power/ high performance. It’s a nice feature but the problem is I never use the discrete GPU, but in a fresh installed Debian, both cards are turned on, generating a lot of heat and consuming/wasting a lot of power and therefore battery. In Virus  Windows you can select which GPU to use with the ATI configuration utility.

I googled for solutions and many people could disable one of the GPUs using a module called vgaswitcheroo, which allows to select which GPU to use as well as turn the unused GPU off. I did everything the tutotials said but I couldn’t get it to work, for some odd reason whenever I tried to turn the discrete GPU off the OS gave some kind of weird errors  and warnings.

So I started looking for another solution, and googling again I found another method to disable the discrete GPU using the acpi_call module, which I’ll describe here.

  • First you need to install the acpi_call module. I did it using this method, which I copy here.

1. Install dkms and some useful packages:

sudo apt-get install dkms git build-essential
sudo apt-get install linux-headers-$(uname -r)

2. Clone the acpi_call repository from git and copy it to where dkms will look for it. We’ll call it version 0.0.1 for now:

git clone
mkdir /usr/src/acpi_call-0.0.1
cp -rp acpi_call/* /usr/src/acpi_call-0.0.1

3. Create a file dkms.conf for it:

sudo gedit /usr/src/acpi_call-0.0.1/dkms.conf

and paste this into it and save it:

CLEAN="make clean"
MAKE[0]="make IGNORE_CC_MISMATCH=1 KDIR=$kernel_source_dir PWD=$dkms_tree/acpi_call/0.0.1/build"

4. Edit the Makefile:

sudo gedit /usr/src/acpi_call-0.0.1/Makefile

and paste this into it and save it:

obj-m := acpi_call.o
 $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
 rm acpi_call.mod.o acpi_call.o acpi_call.ko

5. Add the module to dkms and build and install it:

sudo dkms add -m acpi_call -v 0.0.1
sudo dkms build -m acpi_call -v 0.0.1
sudo dkms install -m acpi_call -v 0.0.1

If all went well, you should now be able to load the module with:

sudo modprobe acpi_call

and this will give some information about it:

modinfo acpi_call
  • to try if it worked you should
sudo sh /usr/src/acpi_call-0.0.1/

and you should get something like this

Trying \_SB.PCI0.P0P1.VGA._OFF: failed
Trying \_SB.PCI0.P0P2.VGA._OFF: failed
Trying \_SB_.PCI0.OVGA.ATPX: failed
Trying \_SB_.PCI0.OVGA.XTPX: failed
Trying \_SB.PCI0.P0P3.PEGP._OFF: works!

now you should check if the GPU is disabled by doing

lspci | grep VGA

and you should get something like this

gary@HP-Debian:~$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
01:00.0 VGA compatible controller: ATI Technologies Inc Robson CE [AMD Radeon HD 6300 Series] (rev ff)

notice the (rev ff) at the end, that means that the GPU is now disconnected

  • If you want to make these changes permanent you need to add acpi_call module to so it can load at startup

First you need to add add acpi_call to /etc/modules

sudo echo acpi_call >> /etc/modules

then create a script in /etc/init.d to run at startup

sudo nano /etc/init.d/script_name_you_want

and copy this into it and save it

#! /bin/bash
 # Provides: script_name_you_want
 # Required-Start: $remote_fs $syslog
 # Required-Stop: $remote_fs $syslog
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Short-Description: Start daemon at boot time
 # Description: Enable service provided by daemon.
 # /etc/init.d/script_name_you_want
 # Carry out specific functions when asked to by the system
 case "$1" in
 echo "Disabling Discrete VGA "
 cd /usr/src/acpi_call-0.0.1/
 echo "Usage: /etc/init.d/script_name_you_want {start}"
 exit 1
 exit 0

then add the appropriate symbolic links to cause the script to be executed

sudo update-rc.d script_name_you_want defaults

If you want to remove the symbolic links

sudo update-rc.d -f script_name_you_want remove