본문 바로가기

임베디드/KERNEL17

insmod mknod chmod 명령어 sudo insmod test_gpio3.ko sudo mknod /dev/gpio_led c 256 0 sudo chmod 666 /dev/gpio_led 2021. 1. 14.
gpio_lcd #include #include #include #include #include #include #include #include #include #include //mdelay(10) ->ms, udelay(1) ->us #include //커널에서 제공하는 gpio 함수 #define __BCM_2711__ /* BCM2837의 I/O Peripherals 주소*/ #if defined(__BCM_2837__) #define BCM_IO_BASE 0x3F000000 #elif defined (__BCM_2711__) #define BCM_IO_BASE 0xFE000000 #elif defined(__BCM_2835__) #define BCM_IO_BASE 0x20000000 #endif // GPIO .. 2021. 1. 8.
라즈베리파이 test_gpio4_irq (button+led) 인터럽트 #include #include #include #include #include #include #include #include #include #include //mdelay(10) ->ms, udelay(1) ->us #include //커널에서 제공하는 gpio 함수 #include #define __BCM_2711__ /* BCM2837의 I/O Peripherals 주소*/ #if defined(__BCM_2837__) #define BCM_IO_BASE 0x3F000000 #elif defined (__BCM_2711__) #define BCM_IO_BASE 0xFE000000 #elif defined(__BCM_2835__) #define BCM_IO_BASE 0x20000000 #endif.. 2021. 1. 7.
라즈베리파이 test_gpio3_func.c 인터럽트 sudo insmod test_gpio3.o sudo mknod /dev/gpio_led c 256 0 sudo chmod 666 /dev/gpio_led #include #include #include #include #include #include #include #include #include #include //mdelay(10) ->ms, udelay(1) ->us #include //커널에서 제공하는 gpio 함수 #define __BCM_2711__ /* BCM2837의 I/O Peripherals 주소*/ #if defined(__BCM_2837__) #define BCM_IO_BASE 0x3F000000 #elif defined (__BCM_2711__) #define BCM_IO_BAS.. 2021. 1. 7.
FATAL: modpost: GPL-incompatible module 에러 MODULE_LICENSE("GPL v2"); 라이센스 문제. 기존 코드는 MODULE_LICENSE("RACK"); 이었음 .. 커널 도움 받아 gpio 제어하기때문에 라이센스를 저렇게 수정 해줘야 된다 2021. 1. 7.
라즈베리파이 gpio _led2 (led + buzzer) 1 누르면 LED 켜지고 부저 한번 울림 (led off 에서 on 상태로 될때만) 2 누르면 LED 꺼지고 부저 두번 울림 (led on 에서 off 상태로 될때만) 3 누르면 프로그램 종료되고 부저 세번 울림 (led는 무조건 off됨) #include #include #include #include #include #include #include #include #include #include //mdelay(10) ->ms, udelay(1) ->us #define __BCM_2711__ /* BCM2837의 I/O Peripherals 주소*/ #if defined(__BCM_2837__) #define BCM_IO_BASE 0x3F000000 #elif defined (__BCM_2711__).. 2021. 1. 4.
라즈베리파이 gpio _led 1. test_gpio1.c (우분투) #include #include #include #include #include #include #include #include #include #include //mdelay(10) ->ms, udelay(1) ->us #define __BCM_2711__ /* BCM2837의 I/O Peripherals 주소*/ #if defined(__BCM_2837__) #define BCM_IO_BASE 0x3F000000 #elif defined (__BCM_2711__) #define BCM_IO_BASE 0xFE000000 #elif defined(__BCM_2835__) #define BCM_IO_BASE 0x20000000 #endif // GPIO 컨트롤러의 주.. 2020. 12. 24.
GPIO 컨트롤 // GPIO 설정 매크로 #define GPIO_IN(g) ( *(gpio+((g)/10)) &= ~(7 2020. 12. 24.
test_dev3.c test_app3.c 메뉴띄우기 switch 1. test_dev3.c Makefile #linux kernel source KDIR = /home/sss/linux obj-m := test_dev3.o default: $(MAKE) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C $(KDIR) M=$$PWD modules clean: $(MAKE) -C $(KDIR) M=$$PWD clean test_dev3.c #include #include #include #include #include #include #define IOCTRL_LED_ON 100 #define IOCTRL_LED_OFF 101 #define IOCTRL_EXIT 102 #define BUFF_SIZE 1024 #define MAJOR_N.. 2020. 12. 21.
test app 메뉴 형식으로 뜨게 수정 -------------------- KERNEL Module Control -------------------- 1. LED ON 2. LED OFF 3. EXIT ------------------- Command: 1 위의 형식으로 뜨게 수정 test app 만 수정 #include #include #include #include #include int main(int argc, char **argv) { int dev = 0; char buff[1024] = { 0,}; char cmd[40] = { 0,}; dev = open("/dev/my_device2", O_RDWR); //open은 한번만 열면 됨 while(1){ printf("--------------------\nKERNEL Modu.. 2020. 12. 21.
디바이스드라이버 LED ON/OFF 1. 호스트 (우분투) #linux kernel source KDIR = /home/sss/linux //커널소스 있는곳 obj-m := test_dev2.o default: $(MAKE) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C $(KDIR) M=$$PWD modules clean: $(MAKE) -C $(KDIR) M=$$PWD clean //test_dev2.c #include #include #include #include #include #include #define BUFF_SIZE 1024 #define MAJOR_NUMBER 257 #define DEVICE_NAME "my_device" static char *buffer = NULL; //커널에.. 2020. 12. 18.
-fstack-protector-strong’ 오류 stackoverflow.com/questions/60578752/unrecognized-command-line-option-fstack-protector-strong-with-arm-linux-gnuea unrecognized command line option ‘-fstack-protector-strong’ with arm-linux-gnueabihf-gcc I have cloned the Raspberry Pi toolchain using the following command and added the tools path to bashrc git clone https://github.com/raspberrypi/tools.git --depth=1 echo PATH=$PATH:~raspberry/to.. 2020. 12. 18.
test_app 1. test_app.c 라즈베리파이에서 작업 test_app.c : 디바이스 드라이버를 사용하는 애플리케이션 # app Makefile CC = gcc OBJECT = test_app.o TARGET = test_app CFLAGS = -g -Wall $(TARGET) : $(OBJECT) $(CC) -o $(TARGET) $(OBJECT) clean: rm -f $(OBJECT) $(TARGET) #include #include #include #include int main(int argc,char *argv[]) { int fd; char val; if(argc < 2 ){ printf("usage: %s [no] \n",*argv); return 1; } fd = open("/dev/testde.. 2020. 12. 17.
Raspberry Pi 4에서 커널 모듈 kernel module 프로그래밍 / hello world https://webnautes.tistory.com/555 호스트 - 우분투 설치된 피시 타겟 - 라즈베리파이 Raspberry Pi 3에서 커널 모듈(kernel module) 프로그래밍 커널 소스 준비 모듈을 작성하기 위해서는 라즈베리파이에서 현재 사용중인 커널 버전과 같은 버전의 커널 소스가 필요합니다. 버전을 맞추기 위해서 라즈베리파이에 커널을 최근 버전으로 webnautes.tistory.com KDIR 한 이유 : #include #include #include 땡겨오려고 .. (가) Hello world 모듈 - 호스트(우분투)에서 작업. #include #include #include static int __init hello_init(void) { printk(KERN_ALERT "He.. 2020. 12. 17.
크로스 컴파일러 환경 *심볼릭 링크ln -s tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/ arm-gccarm-gcc로 들어가면 바로 arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/ 로 들어가진다..길게 치면 힘드니까 만들어주는것 6. 커널설정 및 빌드 7-ㄱ 7-ㄴ 8 2020. 12. 10.
디바이스 드라이버 분석 설계 . host, target 펌웨어 : 일반적으로 os없이 제어 디바이스 드라이버 : 임베디드 운영체제가 반드시 들어감. 커널 안에 디바이스드라이버가 있고 응용프로그램에서 커널을 거쳐 디바이스(하드웨어)제어 porting : 운영체제 인식 스마트팜 만들기 난이도 : 아두이노 소프트웨어를 개발하는 시스템과 실행시키는 시스템이 다르다. 실행되는 시 jeongchul.tistory.com https://hee77.tistory.com/12 임베디드 시스템 이해_02 * 본 포스팅은 개인 공부 목적으로 그 내용이 사실과 다를 수 있습니다 :) 임베디드 시스템 이해 ▶ CONT.. 2020. 12. 10.
kernel https://www.kernel.org/ The Linux Kernel Archives www.kernel.org https://github.com/raspberrypi/linux raspberrypi/linux Kernel source tree for Raspberry Pi Foundation-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://www.raspberrypi.org/forum - raspberryp... github.com 2020. 12. 7.