2022-07-28

[개발노트] yocto에 my-app 넣기.

사전준비

my custom recipe를 만드는법은 많이 나와있으므로, 생성시킴.

bitbake-layers show-layers
bitbake-layers create-layer --priority 7 ../layers/meta-st/meta-ssonic
bitbake-layers add-layer ../layers/meta-st/meta-ssonic


# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-ssonic"
BBFILE_PATTERN_meta-ssonic = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-ssonic = "7"

LAYERDEPENDS_meta-ssonic = "core"
LAYERSERIES_COMPAT_meta-ssonic = "dunfell"


recipes-*/*/*.bb 와 bbappend를 찾는구조임.

recipes-이름/이름/이름.bb 로 만들면됨.

ex) app이라면, 
recipes-app/app/app.bb 로 그냥 만들면됨

recipes-app/app/files 디렉토리를 만들고 그 안에 소스를 넣는다.

app.bb는 자동생성된것을 수정하여 사용한다.

내용은
SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

python do_display_banner() {
    bb.plain("***********************************************");
    bb.plain("*                                             *");
    bb.plain("*  Example recipe created by bitbake-layers   *");
    bb.plain("*                                             *");
    bb.plain("***********************************************");
}

addtask display_banner before do_build

SRC_URI = "file://*"

S = "${WORKDIR}"
P = "r01"

inherit cmake

cmake로 된 프로젝트일때 SRC_URI = "file://*"

CMakeLists.txt
cmake_minimum_required(VERSION 3.0.0)

project(hong)

#set (CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
INCLUDE_DIRECTORIES( .)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lrt -lpthread -ldl -std=gnu99")

add_executable(main main.c)

install (TARGETS main DESTINATION bin)

install은 main이라는 프로그램이 /usr/bin에 들어간다.

끝.


2022-07-26

[개발노트] stm32mp1 kirk 4.0 stm32mp153에서 cpufreq-dt 오류.

커널소스에 두줄 추가.
    { .compatible = "st,stih418", },
    { .compatible = "st,stm32mp151", }, //추가.
    { .compatible = "st,stm32mp153", }, //추가.
    { .compatible = "st,stm32mp157", },
   
    { .compatible = "ti,am33xx", },

[개발노트] sc16is720 켜기

Device Drivers  ---> 
Character devices  ---> 
Serial drivers  ---> 
<*> SC16IS7xx serial support
 [*]   SC16IS7xx for spi interface

2022-07-25

[개발노트] stm32mp1 PWM 켜기

Multifunction device drivers  --->
{*} Support for STM32 Timers

[*] Pulse-Width Modulation (PWM) Support  --->
 <*>   STMicroelectronics STM32 PWM

[개발노트] DSA켜기 커널옵션

순서대로....
[*] Networking support  --->
Networking options  --->
<*>   The IPv6 protocol  --->
 <*> 802.1d Ethernet Bridging
<*> High-availability Seamless Redundancy (HSR & PRP)
<*> Distributed Switch Architecture  ---> 
-*-   Tag driver for SMSC/Microchip LAN9303 family of switches
 
Device Drivers  --->
[*] Network device support  --->
 Distributed Switch Architecture drivers  --->
<*> SMSC/Microchip LAN9303 3-ports 10/100 ethernet switch in MDIO managed mode

2022-07-19

[개발노트] 루트파일시스템만 빌드할때 이렇게.

bitbake -C rootfs st-image-core (대문자주의)

[개발노트]u-boot env를 linux에서 접근하기.

1. build/conf/local.conf 에 라이브러리 추가한다.
IMAGE_INSTALL_append = " u-boot-fw-utils"

2. 루트파일시스템의 etc에 설정파일 추가.
/etc/fw_env.config
# Device name Device offset Env. size Flash sector size
    1. /dev/mmcblk1p1 -0x2000 0x2000
    2. /dev/mmcblk1p1 -0x4000 0x2000

  1. 3. fw_printenv aaa 333 이렇게 쓴다.

[개발노트] 이렇게 정말해야되냐.

커널을 손본후에 이미지빌드를 하면, 원복된다. 왜그럴까.
아래대로 하면 한번은 유지된다.

bitbake -c menuconfig virtual/kernel
bitbake -c savedefconfig virtual/kernel
cp /home/happycpu/work/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/build-openstlinuxweston-stm32mp153d-ssonic/tmp-glibc/work/stm32mp153d_ssonic-ostl-linux-gnueabi/linux-stm32mp/5.10.61-stm32mp-r2-r0/build/defconfig ./workspace/sources/linux-stm32mp/arch/arm/configs/multi_v7_defconfig
bitbake st-image-core

[개발노트] stm32mp1 u-boot 74hc595 살리기 config, dts.

devtool modify u-boot-stm32mp 를 통해 workspace에 생성된?(이동된)  u-boot소스의
device tree는 심볼릭 링크이다. layers.......mx/stm32mp15x{보드명}/u-boot 에 실제파일있음.

1. u-boot 의 configs/stm32mp15_trusted_defconfig 파일 에 spi-gpio를 추가해준다.
(Distribution-package에서는 menuconfig 실행이 지원안되어 직접 config파일 편집함)
CONFIG_DM_74X164=y
CONFIG_SOFT_SPI=y

2. device tree 수정.

루트 맨 밑에 (오버레이항목말고) 그냥 추가
soft_spi: soft-spi {
        compatible = "spi-gpio";
        pinctrl-names = "default";
        //pinctrl-0 = <&pinctrl_spi4>;
        //pinctrl-assert-gpios = <&gpio5 8 GPIO_ACTIVE_LOW>;
        status = "okay";
        gpio-sck = <&gpioe 12 0>;
        gpio-mosi = <&gpioe 14 0>;
        cs-gpios = <&gpioe 11 0>;
        num-chipselects = <1>;
        #address-cells = <1>;
        #size-cells = <0>;
        spi-delay-us = <1>;

        gpio_spi: gpio_spi {
            compatible = "fairchild,74hc595";
            reg = <0>;
            gpio-controller;
            #gpio-cells = <2>;
            registers-number = <4>;
            spi-max-frequency = <100000>;
            output-latch-gpio = <&gpioe 11 0>;
            registers-default = /bits/ 8 <0xFF 0xFF 0x00 0x00>;
        };
    };

u-boot빌드는 이전에 올린 글 참조.

2022-07-18

[개발노트] 74hc595의 초기값 제어 안되는 문제해결


u-boot 의 595는 초기 register-default 값이 적용되는데.
kernel의 595는 초기 값이 제어되지 않는현상.

원인.
u-boot에는 register-default 를 읽어서 적용해주는부분이 있고 커널에는 없고.

대책
제어해주면 되지.

방법.(커널소스 디바이스드라이버 수정)
driver->gpio->gpio-74x164.c 아래 중간부분 추가.
    chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers;

    of_property_read_u8_array(spi->dev.of_node, "registers-default",
                  chip->buffer, chip->registers);

    chip->gpio_chip.can_sleep = true;


[개발노트] Distribution-package의 u-boot 수정 및 컴파및 수정 [ums 이용]

1. devtool modify u-boot-stm32mp
(뭔가 잘못됬을시에는 devtool reset u-boot-stm32mp )

2. 소스수정. 위치는 workspace/source........

3. devtool build u-boot-stm32mp

4. bitbake u-boot-stm32mp -c deploy

5. bitbake tf-a-stm32mp -c deploy -f

최종폴더 fip에 결합된 fipXXX.bin파일이 있음.

u-boot> ums 0 mmc 1
PC$> ls -l /dev/disk/by-partlabel/
lrwxrwxrwx 1 root root 10  7월 18 14:47  boot -> ../../sdd2
lrwxrwxrwx 1 root root 10  7월 18 14:47  fip -> ../../sdd1
lrwxrwxrwx 1 root root 10  7월 18 14:47  rootfs -> ../../sdd4
lrwxrwxrwx 1 root root 10  7월 18 14:47  vendorfs -> ../../sdd3

sudo dd if=tmp-glibc/deploy/images/stm32mp153d-ssonic/fip/fip-stm32mp153d-ssonic-trusted.bin of=/dev/sdd1 bs=1M conv=fdatasync
[sudo] happycpu 암호:
0+1 레코드 들어옴
0+1 레코드 나감
1042421 bytes (1.0 MB, 1018 KiB) copied, 0.0663301 s, 15.7 MB/s

u-boot> reset


2022-07-15

[개발노트]kirkstone build

$ mkdir kirk

$ cd kirk

$ repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15

Fetching: 100% (8/8), done in 5m51.931s
Garbage collecting: 100% (8/8), done in 0.029s
Checking out: 100% (8/8), done in 0.699s
repo sync has finished successfully

$ ls
layers

mx폴더 구성

kirk/layers/meta-st/meta-st-stm32mp-addons/mx/stm32mp153d-ssonic$ ls
kernel  optee-os  tf-a  u-boot

// conf 복사.

kirk/layers/meta-st/meta-st-stm32mp-addons/conf/machine$ ls
examples  stm32mp13-mx.conf  stm32mp15-mx.conf  stm32mp153d-ssonic.conf

// eula 구성

kirk/layers/meta-st/meta-st-stm32mp-addons/conf/eula$ ls
LICENCE.broadcom_bcm43xx  Vivante_GPU_drivers-End_User_Software_License_Terms.txt  stm32mp15-mx
LICENCE.cypress           en.SLA0048.txt                                           stm32mp153d-ssonic
ST_EULA_ALPHA             en.sla0078.txt
ST_EULA_SLA               stm32mp13-mx

 

kirk/layers/meta-st$ MACHINE=stm32mp153d-ssonic DISTRO=openstlinux-weston source layers/meta-st/script/envsetup.sh

 

*주의할점.

MACHINE이름은 꼭. stm32mp15까지는 붙여준다. 이름을 해석해서 해더파일이 합쳐지는 동작이있다.


[개발노트] led, pwm 스크립트




혹시 실행이 안될시에는 파일실행속성 추가

chmod a+x gpio.sh
chmod a+x pwm.sh

[개발노트] esp32c3 적용.



요점
esp32c3의 spi모드가 2-->3으로 변경되어야하므로, esp32c3의 prebuild이미지는 사용할수가 없음.
uart hci는 사용하지않고 spi로만 사용함.-->vhci 모드라고 함.
블루투스는 표준규칙을 잘 따르는듯 한데 wifi는 약간 야매느낌이다.
wifi는 esp32에서 다 해주고. 뭔가 별도의 내부프로토콜로 esp32로의 통신을 중계해주는 구라 network interface 인듯함. 그래서 쓰는법도 좀 다른듯하고 해서 찬찬히 연구해볼필요있음.

순서.
1. esp-hosted의 리눅스 드라이버 빌드
esp-hosted/host/linux/host_driver/esp32/spi/esp_spi.c 아래와 같이 수정.
    //esp_board.mode = SPI_MODE_2;
    esp_board.mode = SPI_MODE_3;
    //esp_board.max_speed_hz = spi_clk_mhz * NUMBER_1M;
    esp_board.max_speed_hz = 5 * NUMBER_1M;

  esp-hosted/host/linux/host_driver/esp32/spi/esp_spi.h 핀번호 변경 ev1 값이므로 ssonic은 다른 번호겠지.  
//#define HANDSHAKE_PIN           111 //evm
#define HANDSHAKE_PIN           105 // ssonic gpiog15
#define SPI_IRQ                 gpio_to_irq(HANDSHAKE_PIN)
//#define SPI_DATA_READY_PIN      55 // evm
#define SPI_DATA_READY_PIN      77 // ssonic gpiob9
#define SPI_DATA_READY_IRQ      gpio_to_irq(SPI_DATA_READY_PIN)

  esp-hosted/host/linux/host_driver/esp32/main.c delay있는 두줄 추가.   
#define HOST_GPIO_PIN_INVALID -1
static int resetpin = HOST_GPIO_PIN_INVALID;
static int delay = 0;
module_param(resetpin, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(resetpin, "Host's GPIO pin number which is connected to ESP32's EN to reset ESP32 device");
module_param(delay, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0))

source /home/happycpu/work/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
export KERNEL=/home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1
make target=spi ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE KERNEL=$KERNEL resetpin=3 
#resetpin은 컴파일할데 인자로 리셋핀을 지정하는 방법임. 지정하지않을경우, 기본3으로 정의됨.gpio번호임. 다른거라면 다른번호로 지정해야함.
happycpu@happycpubox:~/work/testproj/esp-hosted/host/linux/host_driver/esp32$ source /home/happycpu/work/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
happycpu@happycpubox:~/work/testproj/esp-hosted/host/linux/host_driver/esp32$ export KERNEL=/home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1
happycpu@happycpubox:~/work/testproj/esp-hosted/host/linux/host_driver/esp32$ make target=spi ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE KERNEL=$KERNEL resetpin=3
rm -rf *.o sdio/*.o spi/*.o *.ko
make ARCH=arm CROSS_COMPILE=arm-ostl-linux-gnueabi- -C /home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1 M=/home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32 clean
make[1]: 디렉터리 '/home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1' 들어감
  CLEAN   /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/Module.symvers
make[1]: 디렉터리 '/home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1' 나감
make ARCH=arm CROSS_COMPILE=arm-ostl-linux-gnueabi- -C /home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1 M=/home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32 modules
make[1]: 디렉터리 '/home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1' 들어감
  CC [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/esp_bt.o
  CC [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/main.o
  CC [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/spi/esp_spi.o
  CC [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/esp_serial.o
  CC [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/esp_rb.o
  LD [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/esp32_spi.o
  MODPOST /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/Module.symvers
  CC [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/esp32_spi.mod.o
  LD [M]  /home/happycpu/work/testproj/esp-hosted/host/linux/host_driver/esp32/esp32_spi.ko
make[1]: 디렉터리 '/home/happycpu/work/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61.ev1' 나감
happycpu@happycpubox:~/work/testproj/esp-hosted/host/linux/host_driver/esp32$ 

출력파일은 
happycpu@happycpubox:~/work/testproj/esp-hosted/host/linux/host_driver/esp32$ ls
LICENSE   Module.symvers  esp32_spi.ko   esp32_spi.mod.c  esp32_spi.o  esp_bt.c  esp_bt_api.h  esp_rb.c  esp_rb.o      esp_serial.h  main.c  modules.order  spi
Makefile  esp.h           esp32_spi.mod  esp32_spi.mod.o  esp_api.h    esp_bt.o  esp_if.h      esp_rb.h  esp_serial.c  esp_serial.o  main.o  sdio
happycpu@happycpubox:~/work/testproj/esp-hosted/host/linux/host_driver/esp32$ 

scp로 넘겨서 사용. 향후 드라이버는 커널에 합치고, 아래 dev파일은 rootfs에 미리 만들어놓는다. 그래서 부팅하면서 자연스럽게 드라이버까지 올라가도록 
rmmod esp32_spi &> /dev/null
insmod esp32_spi.ko resetpin=3
mknod /dev/esps0 c 221 0
chmod 666 /dev/esps0

2. esp-hosted의 esp32c3용 driver수정.
  esp-hosted/esp/esp_driver/network_adapter/main/spi_slave_api.c 수정 SPI_MODE_3 으로..
    /* Configuration for the SPI slave interface */
    spi_slave_interface_config_t slvcfg={
        //.mode=SPI_MODE_2,
        .mode=SPI_MODE_3,
        .spics_io_num=GPIO_CS,
        .queue_size=SPI_QUEUE_SIZE,
        .flags=0,
        .post_setup_cb=spi_post_setup_cb,
        .post_trans_cb=spi_post_trans_cb
    };

3. esp-hosted의 test용 app 빌드
파이썬이 아닌 c언어 app으로 드라이버를 제어하는 유틸 및 api사용법, api라이브러리 사용법등이 이곳에 있음.
샘플 test.out 파일을 컴파일한다. (그걸로 ap scan 등등을 드라이버로 시킬수있다)
esp-hosted/esp-hosted/host/linux/host_control/c_support
Makefile 수정
첫쩨줄의 gcc를 주석처리함.
#CC = gcc

CROSS_COMPILE :=

컴파일
happycpu@happycpubox:~/work/esp-hosted/esp-hosted/host/linux/host_control/c_support$ make
arm-ostl-linux-gnueabi-gcc  -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/happycpu/work/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi -C -Wall  -I/home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../host_common/include/ -I/home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../../common//protobuf-c/ -I/home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../../common//include/ /home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../../common//protobuf-c/protobuf-c/protobuf-c.c /home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/platform_wrapper.c /home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../../common//esp_hosted_config.pb-c.c /home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../host_common/transport_pserial.c /home/happycpu/work/esp-hosted/esp-hosted/host/linux/host_control/c_support/../../../host_common/commands.c test_api.c test.c -o test.out
happycpu@happycpubox:~/work/esp-hosted/esp-hosted/host/linux/host_control/c_support$ ls
Makefile  platform_wrapper.c  stress.c  test.c  test.out  test_api.c  test_api.h  test_config.h

scp로 넘겨서 사용.


4. device tree
실컷 유저모드 spi설정 다 해놓고선. 마지막에 다시 disable하는것이 끝.
// stm32mp157c-ev1 board.
&spi1{

    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&spi1_pins_z_mx>;
    pinctrl-1 = <&spi1_sleep_pins_z_mx>;
    status = "okay";

    cs-gpios = <&gpioz 3 0>;
    bus-num = <1>;
    num-chipselects = <1>;
   
    #address-cells = <1>;
    #size-cells = <0>;

    spidev1: spi@1{
        status = "okay";
        compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <10000000>;
    };
};

&spidev1{
    status = "disable";
};
//////////////////////////////////////////
// stm32mp153d-ssonic
&spi2{
    pinctrl-names = "default","sleep";
    pinctrl-0 = <&spi2_pins_mx>;
    pinctrl-1 = <&spi2_sleep_pins_mx>;
    status = "okay";
    cs-gpios = <&gpiob 25 0>;

    // /delete-property/dmas;
    // /delete-property/dma-names;

    spidev:spidev@0{
        compatible = "linux,spidev";
        status = "okay";
        reg = <0>;
        spi-max-frequency = <10000000>;
    };
};

&spidev{
    status = "disable";
};

5. yocto bluez
버전을 꼭 높은것을 써야 Codedphy를 사용할수있을듯
레시피에 추가한다. bblayer.conf


참, esp32c3용으로 빌드는
idf.py set-target esp32c3

[개발노트] i2c expander device tree파트




&i2c5{
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&i2c5_pins_mx>;
    //pinctrl-1 = <&i2c5_sleep_pins_mx>;


    i2c-scl-rising-time-ns = <185>;
    i2c-scl-falling-time-ns = <20>;
    status = "okay";
    /* spare dmas for other usage */
    /delete-property/dmas;
    /delete-property/dma-names;

    exp_gpio1: exp_gpio1@20 {
        compatible = "nxp,pcal6416";
        reg = <0x20>;
        gpio-controller;
        #gpio-cells = <2>;
        status = "okay";
        reset-gpios = <&gpiod 11 GPIO_ACTIVE_LOW>;
       
        interrupt-parent = <&gpioe>;
        interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
        interrupt-controller;
        #interrupt-cells = <2>;
    };
};

[개발노트] [dts] 74hc595 정통 spi모드



&spi4 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi4_pins_mx>;
    status = "okay";
   
    //gpio-mosi = <&gpioe 14 0>;
    //gpio-sck = <&gpioe 12 0>;
    cs-gpios = <&gpioe 11 0>;

    /delete-property/dmas; // 필수.
    /delete-property/dma-names;

    num-chipselects = <1>;
    #address-cells = <1>;
    #size-cells = <0>;
   
    spi_gpio@0{
        compatible = "fairchild,74hc595";
        reg = <0>;
        gpio-controller;
        #gpio-cells = <2>;
        registers-number = <4>;
        spi-max-frequency = <10000000>;
        output-latch-gpio = <&gpioe 11 0>;
        registers-default = /bits/ 8 <0xFF 0xFF 0xFF 0xFF>;
    };
};

[기술노트] esp-hosted를 위한 spi2 device tree






&spi2{
    pinctrl-names = "default","sleep";
    pinctrl-0 = <&spi2_pins_mx>;
    pinctrl-1 = <&spi2_sleep_pins_mx>;
    cs-gpios = <&gpiob 9 0>;
    status = "okay";
   
    spidev2: spidev@0{
        compatible = "linux,spidev";
        reg = <0>;
        spi-max-frequency = <20000000>;
    };
};

&spidev2{
    status = "disable";
};

[기술노트] sc16is752 device tree





&spi1{
    pinctrl-names = "default","sleep";
    pinctrl-0 = <&spi1_pins_mx>;
    pinctrl-1 = <&spi1_sleep_pins_mx>;
    status = "okay";
    /delete-property/dmas;
    /delete-property/dma-names;
    cs-gpios = <&gpioa 4 0>;

    sc16is752: sc16is752@0 {
        compatible = "nxp,sc16is752";
        reg = <0>;
        clocks = <&sc16is752_clk>;
        reset-gpios = <&gpiod 11 GPIO_ACTIVE_LOW>; // resetpin
        interrupt-parent = <&gpiod>; // pd4
        interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
        gpio-controller;
        #gpio-cells = <2>;
        clock-frequency = <20000000>;
        sc16is752_clk: sc16is752_clk {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <1843200>;
        };      
    };  
};


[    1.894651] sc16is752@0 enforce active low on chipselect handle
[    1.897624] serial serial0: tty port ttySC0 registered
[    1.898114] spi1.0: ttySC1 at I/O 0x1 (irq = 56, base_baud = 115200) is a SC16IS752
[    1.898533] serial serial1: tty port ttySC1 registered

[기술노트] 패치파일 만들기


<.patch 만들기>

diff -uNr [원본파일 또는 경로] [수정파일 또는 경로] > [패치파일명]

ex) a.cpp를 b.cpp로 수정한후 b.patch를 생성

    diff -uNr a.cpp b.cpp > b.patch

 

<patch 적용하기>

patch [옵션] [원본파일] [패치파일]

ex) b.patch를 a.cpp에 적용하려면

   patch a.cpp b.patch


암호화 + base64 하고 쉘스크립트.

 #!/bin/bash # IV와 UserKey를 설정합니다 (아스키 문자열을 그대로 사용). IV="0123456789abcdef"  UserKey="0123456789abcdef" # IV와 UserKey를 16...