
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.armadeus.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jean-jacquesC</id>
		<title>ArmadeusWiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.armadeus.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jean-jacquesC"/>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=Special:Contributions/Jean-jacquesC"/>
		<updated>2026-04-30T02:16:12Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=GPIO_LEDS&amp;diff=11474</id>
		<title>GPIO LEDS</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=GPIO_LEDS&amp;diff=11474"/>
				<updated>2012-12-11T10:13:50Z</updated>
		
		<summary type="html">&lt;p&gt;Jean-jacquesC: /* Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;How to use leds-gpio driver to manage states of connected leds of your Armadeus board.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
You can manage a led connected to a GPIO pin. The LED management is similar with the standard GPIO sysfs driver, but you have some new features like triggers (e.g. &amp;quot;heartbeat&amp;quot; LED blinks like a heart at the rate oh the CPU load) . Here are the GPIO used for the user LED for each APF board:&lt;br /&gt;
* APF9328: PORT A / bit 2&lt;br /&gt;
* APF27: GPIO_PORTF | 14&lt;br /&gt;
* APF28: PINID_GPMI_RDY1 (Bank 0 - pin 21)&lt;br /&gt;
* APF51: GPIO_PORTA | 2&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
First, you need to enable the leds-gpio driver in your kernel and some triggers like the &amp;quot;heartbeat&amp;quot; trigger  to make the LED flash like a heartbeat.&lt;br /&gt;
&lt;br /&gt;
* Configure Linux kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make linux-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device Drivers  ---&amp;gt;&lt;br /&gt;
     --- LED support&lt;br /&gt;
         [*] LED Class Support&lt;br /&gt;
              *** LED drivers *** &lt;br /&gt;
         &amp;lt;*&amp;gt; LED Support for GPIO connected LEDs&lt;br /&gt;
              [*] Platform device bindings for GPIO LEDs&lt;br /&gt;
              *** LED Triggers ***&lt;br /&gt;
         [*]   LED Trigger support&lt;br /&gt;
         &amp;lt;*&amp;gt;     LED Timer Trigger&lt;br /&gt;
         &amp;lt;*&amp;gt;     LED Heartbeat Trigger&lt;br /&gt;
         &amp;lt;*&amp;gt;     LED backlight Trigger&lt;br /&gt;
         &amp;lt;*&amp;gt;     LED Default ON Trigger&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, in your ''apfXX-dev.c'', you would need to define your LED &amp;lt;b&amp;gt;before&amp;lt;/b&amp;gt; the variable ''platform_devices[]''. This code is already implemented for the APF27, APF28 and APF51 so the source code hereafter (for the APF27) is only present as a reference sample to understand how to activate a GPIO LED driver.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;linux/leds.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* GPIO LED */&lt;br /&gt;
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)&lt;br /&gt;
static struct gpio_led apf27dev_led[] = {&lt;br /&gt;
	{&lt;br /&gt;
		.name = &amp;quot;apfdev:green:user&amp;quot;,&lt;br /&gt;
		.default_trigger = &amp;quot;heartbeat&amp;quot;,&lt;br /&gt;
		.gpio = (GPIO_PORTF | 14),&lt;br /&gt;
		.active_low = 1,&lt;br /&gt;
	},&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
static struct gpio_led_platform_data apf27dev_led_data = {&lt;br /&gt;
	.num_leds	= ARRAY_SIZE(apf27dev_led),&lt;br /&gt;
	.leds		= apf27dev_led&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
static struct platform_device apf27dev_led_dev = {&lt;br /&gt;
	.name		= &amp;quot;leds-gpio&amp;quot;,&lt;br /&gt;
	.id		= -1,&lt;br /&gt;
	.dev		= {&lt;br /&gt;
		.platform_data	= &amp;amp;apf27dev_led_data,&lt;br /&gt;
	},&lt;br /&gt;
};&lt;br /&gt;
#endif /* CONFIG_LEDS_GPIO */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the LED to get it managed by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
static struct platform_device *platform_devices[] __initdata = {&lt;br /&gt;
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)&lt;br /&gt;
	&amp;amp;apf27dev_led_dev,&lt;br /&gt;
#endif&lt;br /&gt;
	ALSA_SOUND&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild and update your bard with the new kernel.&lt;br /&gt;
Upon the next kernel boot you should see the LED flash like a heartbeat (if you have activated the &amp;quot;heartbeat&amp;quot; trigger)&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ls /sys/class/leds/apfdev\:green\:user/&lt;br /&gt;
brightness      max_brightness  subsystem       uevent&lt;br /&gt;
device          power           trigger&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can change the trigger behaviors. By default, Heartbeat is selected:&lt;br /&gt;
* &amp;quot;heatbeat&amp;quot;: led blinks like a heart and blink frequency will change according o the CPU activity.&lt;br /&gt;
* &amp;quot;nand-disk&amp;quot;: the led will blink each time nand access occur (try with ''sync'' command to see it blinking).&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/leds/apfdev\:green\:user/trigger &lt;br /&gt;
none nand-disk mmc0 timer [heartbeat] backlight gpio default-on &lt;br /&gt;
&lt;br /&gt;
# echo none &amp;gt; /sys/class/leds/apfdev\:green\:user/trigger &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Switch on and off the LED&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/leds/apfdev\:green\:user/max_brightness &amp;gt; /sys/class/leds/apfde&lt;br /&gt;
v\:green\:user/brightness &lt;br /&gt;
&lt;br /&gt;
# echo 0 &amp;gt; /sys/class/leds/apfdev\:green\:user/brightness &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to switch led state using the APF28Dev user button. This button is seen as gpio17 (as seen under APF28Dev [[datasheet]]) under Linux, then configure the led trigger as gpio :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# echo &amp;quot;gpio&amp;quot; &amp;gt; /sys/class/leds/apfdev:green:user/trigger&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New config files are available :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ls /sys/class/leds/apfdev:green:user/&lt;br /&gt;
brightness          gpio                power               uevent&lt;br /&gt;
desired_brightness  inverted            subsystem&lt;br /&gt;
device              max_brightness      trigger&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the trigger gpio can be configured with ''gpio'' file :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# echo 17 &amp;gt; /sys/class/leds/apfdev:green:user/gpio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then pushing the user switch will now commute the LED state.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://www.kernel.org/doc/Documentation/leds/leds-class.txt&lt;/div&gt;</summary>
		<author><name>Jean-jacquesC</name></author>	</entry>

	<entry>
		<id>http://www.armadeus.org/wiki/index.php?title=Boa&amp;diff=11473</id>
		<title>Boa</title>
		<link rel="alternate" type="text/html" href="http://www.armadeus.org/wiki/index.php?title=Boa&amp;diff=11473"/>
				<updated>2012-12-11T09:03:40Z</updated>
		
		<summary type="html">&lt;p&gt;Jean-jacquesC: /* Create the access log directory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;font-size: 2em; font-weight:bold;&amp;quot;&amp;gt; How-to install and configure the Boa Web server on your Armadeus board &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:boa.png|right]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
==Installation==&lt;br /&gt;
* Launch Buildroot's configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Select: &lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*]   Show packages that are also provided by busybox&lt;br /&gt;
        ...&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        [*]   boa&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Save the configuration&lt;br /&gt;
* Then build the binaries and the default filesystem. This will be useful later to perform the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
&lt;br /&gt;
=== Generalities ===&lt;br /&gt;
&lt;br /&gt;
To apply a permanent configuration, be sure not to change anything on the board filesystem: that would be erased the next time you reflash the rootfs. &amp;lt;br&amp;gt; &lt;br /&gt;
Instead, do all changes on the filesystem located on the Host, i.e. on ''buildroot/project_build_armv4t/apf9328/root/'' for the APF9328 or ''buildroot/project_build_armv5te/apf27/root/'' for the [[APF27]].&lt;br /&gt;
&lt;br /&gt;
The Boa configuration file is located in ''/etc/boa/boa.conf'' on the board; this means that to permanently change the configuration, you need to edit the file ''buildroot/project_build_armvXX/apfXX/root/etc/boa/boa.conf'' '''on the Host'''.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the root directory name is dependent of the target, there is a way to find it automatically:&lt;br /&gt;
 $ make shell_env &amp;amp;&amp;amp; source armadeus_env.sh&lt;br /&gt;
Then the directory can be accessed with ''$ARMADEUS_ROOTFS_DIR''.&lt;br /&gt;
&lt;br /&gt;
=== Create a Dummy page ===&lt;br /&gt;
&lt;br /&gt;
*By default, DocumentRoot is set to /var/www, so let's add a dummy file here to test our configuration:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $ARMADEUS_ROOTFS_DIR/var/www&lt;br /&gt;
 $ vim $ARMADEUS_ROOTFS_DIR/var/www/index.html&lt;br /&gt;
&lt;br /&gt;
*And fill the file with:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;title&amp;gt; Welcome on the Armadeus Board &amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;nowiki&amp;gt;&amp;lt;h1&amp;gt; Welcome on the Armadeus Board &amp;lt;/h1&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable hostname resolution ===&lt;br /&gt;
&lt;br /&gt;
*Boa has to be able to resolve the hostname to work, so let's do:&lt;br /&gt;
&lt;br /&gt;
 $ echo &amp;quot;127.0.0.1 `cat $ARMADEUS_ROOTFS_DIR/etc/hostname`&amp;quot; &amp;gt;&amp;gt; $ARMADEUS_ROOTFS_DIR/etc/hosts&lt;br /&gt;
&lt;br /&gt;
=== Create the access log directory ===&lt;br /&gt;
&lt;br /&gt;
*By default, Boa logs will be stored in ''/var/log/boa/''. If you didn't not change this setting, you will need to perform the following :&lt;br /&gt;
 $ ls -l $ARMADEUS_ROOTFS_DIR/var/log&lt;br /&gt;
&lt;br /&gt;
*If it's a link to ''/tmp'', then &lt;br /&gt;
 $ rm -f $ARMADEUS_ROOTFS_DIR/var/log &amp;amp;&amp;amp; mkdir $ARMADEUS_ROOTFS_DIR/var/log/&lt;br /&gt;
&lt;br /&gt;
*Then, create the boa directory :&lt;br /&gt;
 $ mkdir $ARMADEUS_ROOTFS_DIR/var/log/boa&lt;br /&gt;
&lt;br /&gt;
-----&lt;br /&gt;
Why shoud I delete the symbolink link? &amp;lt;br&amp;gt;&lt;br /&gt;
This is because during the filesystem creation, mkfs.jffs2 will keep the link from ''/var/log'' to ''/tmp'' on the board.&lt;br /&gt;
Thus, once on the board, you will have:&lt;br /&gt;
&amp;lt;pre class=apf&amp;gt;&lt;br /&gt;
 # ls -l /var/log&lt;br /&gt;
 lrwxrwxrwx    1 root     root            4 Apr 15  2007 /var/log -&amp;gt; /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With such a behavior, even if you fill the directory ''$ARMADEUS_ROOTFS_DIR/var/log/'' on your host&lt;br /&gt;
(which actually fill ''/tmp'' on your host), nothing will be saved once the filesystem will be flashed on your board.&lt;br /&gt;
&lt;br /&gt;
== Test the result ==&lt;br /&gt;
&lt;br /&gt;
*Create the final rootfs:&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
*Then [[Target_Software_Installation | update the rootfs]] on your board. Reboot it, and start Boa:&lt;br /&gt;
&amp;lt;pre class=apf&amp;gt;&lt;br /&gt;
 # boa&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*To access your web page, use a browser:&lt;br /&gt;
 http://''&amp;lt;your board's IP Address&amp;gt;''/&lt;br /&gt;
&lt;br /&gt;
You should see the page ! &amp;lt;br /&amp;gt;&lt;br /&gt;
If not, check the file ''/var/log/boa/error_log'' on your board&lt;br /&gt;
&lt;br /&gt;
[[Image:Boa_welcome.png]]&lt;br /&gt;
&lt;br /&gt;
== Working with cgi ==&lt;br /&gt;
&lt;br /&gt;
*First, check the ''boa.conf'' file. Once more, you should use the one located on your host before changing anything.&lt;br /&gt;
 $ vi $ARMADEUS_ROOTFS_DIR/etc/boa/boa.conf&lt;br /&gt;
&lt;br /&gt;
*Be sure to have an uncommented line like this:&lt;br /&gt;
 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/&lt;br /&gt;
&lt;br /&gt;
*Now, let's write a dummy cgi:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin&lt;br /&gt;
 $ vim $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin/get_ipconfig.sh&lt;br /&gt;
&lt;br /&gt;
*And add the following :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
echo -e &amp;quot;Content-type: text/html\r\n\r\n&amp;quot;;&lt;br /&gt;
echo -e `/sbin/ifconfig  eth0 | grep 'inet addr'`;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The script have to be executable: &lt;br /&gt;
 $ chmod a+x $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin/get_ipconfig.sh&lt;br /&gt;
&lt;br /&gt;
*Then change your index.html page to add a link to the cgi:&lt;br /&gt;
&lt;br /&gt;
 $ vi $ARMADEUS_ROOTFS_DIR/var/www/index.html&lt;br /&gt;
&amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;title&amp;gt; Welcome on the Armadeus Board &amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
        &amp;lt;h1&amp;gt; Welcome on the Armadeus Board &amp;lt;/h1&amp;gt;&lt;br /&gt;
        &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
        &amp;lt;a href=http://&amp;lt;Your board IP Address&amp;gt;/cgi-bin/get_ipconfig.sh&amp;gt; Get the board ip config &amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;br&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Create the new rootfs:&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
*Finally, [[Target_Software_Installation | transfer the rootfs]] to the board &amp;amp; flash it.&lt;br /&gt;
&lt;br /&gt;
You can now access to the new web page and click on the cgi link !&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://www.boa.org The Boa Web page]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Web]]&lt;/div&gt;</summary>
		<author><name>Jean-jacquesC</name></author>	</entry>

	</feed>