ÀÌ ¸Å´º¾óÀº JKÀüÀÚ(JK Electronics) ¿¡ ÀÇÇؼ­ ¹ø¿ª, ¼öÁ¤, ÀÛ¼º µÇ¾ú°í ¼ÒÀ¯±Ç ¶ÇÇÑ
JKÀüÀÚ(JK Electronics)
ÀÇ °ÍÀÔ´Ï´Ù. ¼ÒÀ¯±ÇÀÚÀÇ Çã°¡¸¦ ¹ÞÁö ¾Ê°í ¹«´ÜÀ¸·Î ¼öÁ¤, »èÁ¦Çϰųª ¹èÆ÷ ÇÒ ¼ö ¾ø½À´Ï´Ù.

 

S5PV210 SDK Linux µð¹ÙÀ̽º µå¶óÀ̹ö Developer Guide


 
* Update history

- 2012.2.23 : Ãʱâ Release


 

1. Install cross-build compiler

AM¿ë ÀÓº£µðµå ¸®´ª½ºÀÇ ¾îÇø®ÄÉÀ̼ÇÀ» °³¹ßÇϱâ À§Çؼ­´Â ÄÄÆÄÀÏ·¯·Î °³¹ß¿ë Linux PC¿¡ ARM¿ë Å©·Î½º ÄÄÆÄÀÏ·¯¸¦ ¼³Ä¡ ÇØ¾ß ÇÕ´Ï´Ù. ÀÌ °³¹ßº¸µå¸¦ À§Çؼ­´Â arm-linux-gcc-4.5.1 ÄÄÆÄÀÏ·¯¸¦ ¼³Ä¡ ÇØ¾ß ÇÕ´Ï´Ù. ÀÌ ÄÄÆÄÀÏ·¯´Â armv6 Instruction set and support hardware floating-point operations µîÀ» Áö¿ø ÇÕ´Ï´Ù. ÀÚ¼¼ÇÑ ¼³Ä¡ ¹æ¹ýÀº ¸®´ª½º °³¹ßÀÚ °¡À̵带 ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù.

1. Linux °³¹ßÀÚ °¡À̵å(Ä¿³Î ÄÄÆÄÀÏ, ÆÄÀϽýºÅÛ, Qt Æ÷Æà µî)

°³¹ßº¸µå¿¡ ´ëÇÑ ¸ðµç ÄÜ¼Ö ¾îÇø®ÄÉÀÌ¼Ç ¼Ò½º´Â CD/Linux/examples-mini210-20111119.tga ÆÄÀÏ·Î ¾ÐÃàÀÌ µÇ¾î ÀÖ½À´Ï´Ù.

¾Æ·¡ ¿¹Á¦µéÀº S3C6410 StartKit °³¹ßº¸µåÀÇ ¸®´ª½º µð¹ÙÀ̽º µå¶óÀ̹ö ¿¹Á¦ ÀÔ´Ï´Ù. ½ÇÁ¦ CPU Æ÷Æ®µîÀº ´Ù¸¦ ¼ö ÀÖÀ¸³ª °úÁ¤Àº µ¿ÀÏÇÏ´Ï Âü°í¸¸ ÇϽñ⠹ٶø´Ï´Ù.

1.1 Device Driver Programming

À̹ø Àý¿¡¼­´Â Ä¿³Î ¸ðµå¿¡¼­ÀÇ ¸®´ª½º µð¹ÙÀ̽º ÀÛ¼º ¿¹Á¦µéÀ» »ìÆì º¸µµ·Ï ÇÕ´Ï´Ù.
¾Æ·¡ Ç¥´Â °³¹ßº¸µå¿¡ Æ÷ÆõǾî ÀÖ´Â ¸®´ª½º Ä¿³ÎÀÇ µð¹ÙÀ̽ºÀ̸§°ú ¼Ò½º µð·ºÅ丮 À§Ä¡ ÀÔ´Ï´Ù. ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù.

LED IO Æ÷Æ® À̸§ CPU Pin name


1.1.1 Hello, Module-simple Device Driver Example

µå¶óÀ̹ö ¼Ò½º µð·ºÅ丮 /opt/FriendlyARM/tiny210/linux/linux-2.6.35/drivers/char
µå¶óÀ̹ö ¼Ò½º ÆÄÀÏ À̸§ mini210_hello_module.c
The driver will not load any device in the dev node

#include <linux/kernel.h>
#include <linux/module.h>

static int __init tiny210_hello_module_init(void)
{
printk("Hello, tiny210 module is installed !\n");
return 0;
}

static void __exit tiny210_hello_module_cleanup(void)
{
printk("Good-bye, tiny210 module was removed!\n");
}

module_init(tiny210_hello_module_init);
module_exit(tiny210_hello_module_cleanup);
MODULE_LICENSE("GPL");



(1) "Hello, Module" À» Ä¿³Î ¼Ò½º Æ®¸®¿¡ ³Ö¾î¼­ ÄÄÆÄÀÏ ÇÏ´Â ¹æ¹ý(added to the kernel source tree, and compile)

General compile the driver module version 2.6 driver code need to be added to the kernel source tree, and make the appropriate configuration. make menuconfig ¸í·É¿¡ ÀÇÇؼ­ ¼±Åà ÇÒ ¼ö ÀÖµµ·Ï ÇÕ´Ï´Ù.


Step1 : Kconfig ÆÄÀÏÀ» ¿­¾î ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ ÇÕ´Ï´Ù. Open "linux-2.6.35/drivers/char/Kconfig" file

s3c6410

linux-2.6.35 Ä¿³ÎÀÌ ÀÖ´Â µð·ºÅ丮¿¡¼­ "make menuconfig" ¸í·ÉÀ» ½ÇÇà ÇÕ´Ï´Ù.

s3c6410


Device
Drivers -> Character devices -> "mini210 module sample" ¿¡¼­ <M> À» ¼±ÅÃÇÏ¸é ¸ðµâ·Î ÄÄÆÄÀÏ µÈ´Ù´Â ÀǹÌÀÌ°í "*" ¸¦ ¼±ÅÃÇϸé Ä¿³Î¿¡ Æ÷ÇÔÇؼ­ ÄÄÆÄÀÏ ÇÑ´Ù´Â ÀÇ¹Ì ÀÔ´Ï´Ù. ¿©±â¿¡¼­´Â <M> À¸·Î ¼±ÅÃÇÕ´Ï´Ù.

Step2: Step1¿¡¼­ÀÇ ¼³Á¤Àº Ä¿³Î ÄÁÇDZԷ¹À̼ǻóÀÇ ¼³Á¤ÀÌ°í ½ÇÁ¦·Î´Â À̹ø ´Ü°è¿¡¼­ MakefileÀ» ¼öÁ¤ ÇÑ°ÍÀÌ ÄÄÆÄÀϽà ¹Ý¿µÀÌ µË´Ï´Ù. "linux-2.6.35/drivers/char/Makefile" ÆÄÀÏÀ» Open ÇÕ´Ï´Ù.

s3c6410

Step3: À̹ø ´Ü°è¿¡¼­´Â ½ÇÁ¦·Î ¸ðµâ·Î ¼Ò½º ÆÄÀÏÀ» ÄÄÆÄÀÏ ÇÏ´Â ´Ü°è ÀÔ´Ï´Ù.

s3c6410

(2) "Hello, Module download and install it using the development board

FTP¸¦ ÀÌ¿ëÇؼ­ Ÿ°Ù °³¹ßº¸µåÀÇ "/lib/modules/2.6.35-FriendlyARM" À§Ä¡¿¡ "tiny210_hello_module.ko" ÆÄÀÏÀ» ´Ù¿î·Îµå ÇÕ´Ï´Ù. ±×¸®°í ³ª¼­ "modprobe" ¸í·ÉÀ» À§Çؼ­ ¸ðµâÀ» Ä¿³Î¿¡ Load ÇÕ´Ï´Ù modprobe ¸í·É½Ã "ko" È®ÀåÀÚ´Â ºÙÀÌÁö ¾Ê½À´Ï´Ù.

# modprobe tiny210_hello_module

´ÙÀ½ ¸í·ÉÀº ¸ðµâÀº Unload ÇÏ´Â ¸í·É ÀÔ´Ï´Ù.

# rmmod tiny210_hello_module

s3c6410

1.1.2 LED Driver

LED1 ~ LED4±îÁö¸¦ ÄÁÆ®·Ñ ÇÏ´Â µð¹ÙÀ̽º µå¶óÀ̹ö ¿¹Á¦ ÀÔ´Ï´Ù. °¢ LEDµéÀÇ 6410 CPU¿¡ ÇÒ´çµÈ ¸®¼Ò½º ÀÔ´Ï´Ù.

LED IO Æ÷Æ® À̸§ CPU Pin name
LED1 GPK4 R23
LED2 GPK5 R22
LED3 GPK6 R24
LED4 GPK7 R25



µå¶óÀ̹ö ¼Ò½º µð·ºÅ丮 /opt/FriendlyARM/tiny210/linux/linux-2.6.36/drivers/char
µå¶óÀ̹ö ¼Ò½º ÆÄÀÏ À̸§ tiny210_leds.c
Device Type misc
Device Name /dev/leds
¿¹Á¦ ¼Ò½º µð·ºÅ丮 À§Ä¡ /opt/FriendlyARM/tiny210/linux/examples/leds
µå¶óÀ̹ö ¼Ò½º ÆÄÀÏ À̸§ led.c
µå¶óÀ̹ö ÆÄÀÏ À̸§ led
The driver will not load any device in the dev node

#include <linux/miscdevice.h>
#include <linux/delay.h>
#include <asm/irq.h>
//#include <mach/regs-gpio.h>
#include <mach/hardware.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/ioctl.h>
#include <linux/cdev.h>
#include <linux/string.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <asm/unistd.h>
#include <mach/map.h>
#include <mach/regs-clock.h>
#include <mach/regs-gpio.h>
#include <plat/gpio-cfg.h>
#include <mach/gpio-bank-e.h>
#include <mach/gpio-bank-k.h>

#define DEVICE_NAME "leds"

static long sbc2440_leds_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
switch(cmd) {
unsigned tmp;
case 0:
case 1:
if (arg > 4) {
return -EINVAL;
}
tmp = readl(S3C64XX_GPKDAT);
tmp &= ~(1 << (4 + arg));
tmp |= ( (!cmd) << (4 + arg) );
writel(tmp, S3C64XX_GPKDAT);
//printk (DEVICE_NAME": %d %d\n", arg, cmd);
return 0;
default:
return -EINVAL;
}
}
static struct file_operations dev_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = sbc2440_leds_ioctl,
};
static struct miscdevice misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = DEVICE_NAME,
.fops = &dev_fops,
};
static int __init dev_init(void)
{
int ret;
{
unsigned tmp;
(tmp & ~(0xffffU<<16))|(0x1111U<<16);
writel(tmp, S3C64XX_GPKCON);
tmp = readl(S3C64XX_GPKDAT);
tmp |= (0xF << 4);
writel(tmp, S3C64XX_GPKDAT);
}
ret = misc_register(&misc);
printk (DEVICE_NAME"\tinitialized\n");
return ret;
}
static void __exit dev_exit(void)
{
misc_deregister(&misc);
}
module_init(dev_init);
module_exit(dev_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("FriendlyARM Inc.");