Skip to content
Wei-Lun edited this page Jan 9, 2025 · 324 revisions

Welcome to the my_note wiki!

Markdown

sourece code 分析

CPU


Open Resource

ARM

RISC-V

RISC misc

  • .option

    局部 enable 特殊指令集

    /* 在 .option rvc; 和 .option pop; 之間便可以使用 RVC 指令集.
     * 而之外的部分, 則會只能使用正常指令集
     */
    .option push;
    .option rvc;
        c.addi a0, 1;
        c.slli a0, 1;
    .option pop

Andes

Common

CPU benchmark

Cache

Memory

MPU

backtrace

ROM patch (固件補丁)

MCU vendor


Open Source (github)

Google

MTK

HDSC

STM32

RTK

ESP

Nuvoton

Raspberry

NXP

雅特力(Artery)

Qemu

# -append "root=/dev/mmcblk0 console=ttyAMA0 loglevel=8"
$ qemu-system-arm -M vexpress-a9 -smp 4 -m 256M \
    -kernel output/images/zImage \
    -append "root=/dev/mmcblk0 console=ttyAMA0 loglevel=8" \
    -dtb output/images/vexpress-v2p-ca9.dtb \
    -sd output/images/rootfs.ext2 \
    -nographic \
    -net nic,model=lan9118 \
    -net user
killall qemu-system-arm

Machine Learning (ML)


Convolution

uTensor

Caffe

Keras

TensorFlow

Speech Recognition

ICE


Keil-C

DAP-Link

OpenOCD

EmBitz

SWO

Windows


FTDI

Visual Studio

RTOS


FreeRTOS

Huawei LiteOS

AliOS

RT-Thread

ThreadX

u-boot

eMMC

linux

linux performance tool

  • Linux內核發展史 (1)

  • kernel ramdisk

    kernel預設ramdisk大小是4096KB
    如果我們要更改ramdisk大小可以在grub的menu.lst裡更改開機參數
    root (hd0, 0)
    kernel /boot/vmlinuz-2.4.34 rw root=/dev/ram0 init=/linuxrc vga=0x314 ramdisk=10240(10MB的意思)
    
    #ro代表read-only
    #如果想要可以在rootfs裡執行寫入的動作可以改成rw(read-write)
    #vga是設定支援framebuffer的參數0x314是代表800x600的解析度(網路上有表可以查詢)
    
    這樣我們就可以在ramdisk裡裝更多東西啦~
    

kernel debug

Core dump

device driver

device tree

skb

NET


lwip

TFTP

BLE

WiFi

NS3

Optimization and Tuning

Build System

Program langage


C

C++

Bash

Assembly

Python

Compiler

toolchain

GCC

GDB

$ CC=gcc ./configure --enable-tui --with-curses --build=i686-w64-mingw32 --host=x86_64-w64-mingw32
x86_64-pc-msys
$ make

linkscript

LLVM

Editor

VIM

Word

Version control

GIT

SVN

Remote

tmate

putty

- [在Linux與Windows間傳送檔案](https://loveamberbird.wordpress.com/2013/08/21/%E3%80%90%E7%AD%86%E8%A8%98%E3%80%91%E5%9C%A8linux%E8%88%87windows%E9%96%93%E5%82%B3%E9%80%81%E6%AA%94%E6%A1%88%E6%AD%A5%E9%A9%9F%E6%95%99%E5%AD%B8/amp/)
- [Putty/Vim/Tmux 256色愛恨情愁](https://blog.laszlo.tw/?p=1057)
- [Copying commands with PuTTY and tmux](https://unix.stackexchange.com/questions/316751/copying-commands-with-putty-and-tmux)
- [bindable commands (keypad)](http://web.mit.edu/gnu/doc/html/features_7.html#SEC51)

tmux

File system

QT

IMGui

SDL2

Crypto

RC6

MD5

Software Licensing

MISC

  • SurveyCake
  • QCSG (中国南方电网有限责任公司)
  • SGCC (国家电网)
sw rs2, offset(rs1)     // *(rs1 + sign(offset)) = *rs2
lw rd, offset(rs1)      // *rd = *(rs1 + sign(offset))

state machine

typedef struct state_node {
    uint32_t    state_id;

    void    *argv;
    int (*method)(void *argv);

    struct state_node   *next;
} state_node_t;

Xmodem

MSYS2

IAP

  • IAP/ISP/ICP

    • ICP (In Circuit Program)

      由 H/w 電路來支援燒錄, e.g. BIST

    • ISP (In System Program)

      由系統端來支援燒錄, 一般會是 bootloader 的腳色

      可以在 PROM 或是 Flash

    • IAP (In Application Program)

      由應用端來支援燒錄, 廠家可以從 APP 來決定如何使用自家的燒錄方式

      • 從 APP 下載 IAP 程序, 再切換到 IAP 程序來進行燒錄
      • 將想要更新的 img, 下載到 IAP 佔存
      • 其他
  • ISP與IAP的區別

  • ISP與IAP, 寫在一起就是一家人?

  • STM32 + IAP + Ymodem完美結合

VCP

minicom

ERP

無損壓縮

IoT

AWS IoT

Image Process

ISP

OpenCV

Camera

RTL

DSP

Peripheral

USB

SW_UART

SW_SPI

  • spiflash/attiny/spi_sw.c

  • *pic-libraries/softwareSPI.c

  • TMC2130Stepper/src/source/SW_SPI.cpp

  • MajenkoLibraries/SoftSPI

  • chipKIT-core/pic32/libraries/SoftSPI/

  • nrf/src/softspi.c

  • micropython/drivers/bus/

  • example

    //Define all SPI Pins
    #define SPI_OUT     RC4_bit     /* Define SPI SDO signal to be PIC port RC4 */
    #define SPI_IN      RC5_bit     /* Define SPI SDI signal to be PIC port RC5 */
    #define SPI_CLK     RC3_bit     /* Define SPI CLK signal to be PIC port RC3 */
    #define SPI_CS      RB1_bit     /* Define SPI CS signal to be PIC port RB1 */
    
    /**
     * This function writes a byte out onto the SPI OUT port, and reads a byte from
     * the SPI IN port.
     *
     * @param c Gives the byte to write out onto the SPI port
     *
     * @return Returns the byte read from the SPI IN port
     */
    char spiPutGetByte(char c) {
        char ret;
        unsigned char mask;
    
        //SPI Mode 0. CS active low. Clock idle 0. Clock rising edge.
        SPI_CLK = 0;
    
        //Enable SPI communication. The SPI Enable signal must be pulsed low for each byte sent!
        SPI_CS = 0;
    
        //Ensure a minimum delay of 500ns between falling edge of SPI Enable signal
        //and rising edge of SPI Clock!
        Nop();
        mask = 0x80;                //Initialize to write and read bit 7
        ret = 0;                    //Initialize read byte with 0
    
        do  {
            SPI_OUT = 0;                //Clock out current bit onto SPI Out line
            if (c & mask) SPI_OUT = 1;
            SPI_CLK = 1;                //Set SPI Clock line
            if (SPI_IN) ret |= mask;    //Read current bit fromSPI In line
            Nop();                      //Ensure minimum delay of 500nS between SPI Clock high and SPI Clock Low
            SPI_CLK = 0;                //Set SPI Clock line
            mask = mask >> 1;           //Shift mask so that next bit is written and read from SPI lines
            Nop();                      //Ensure minimum delay of 1000ns between bits
        } while (mask != 0);
    
    
        //Ensure a minimum delay of 750ns between falling edge of SPI Clock signal
        //and rising edge of SPI Enable!
        Nop();Nop();
    
        //Disable SPI communication. The SPI Enable signal must be pulsed low for each byte sent!
        SPI_CS = 1;
    
        return ret;
    }
  • example1

    #include <SPI.h>
    #include "ButtonDebounce.h"
    #include "basic_clock.h"
    #include "unknown.h"
    #define CS_Bit 2 /* A2 is bit 2 in PortC */
    #define SClk_Bit 5 /* pin 13 is bit 5 in PortB */
    #define MISO_Bit 4 /* pin 12 is bit 1 in PortB */
    int count;
    int EncoderValueT;
    void SW_SPI_Initialize()
    {
        bitSet(DDRC, CS_Bit);
        bitSet(PORTC, CS_Bit);
        bitSet(DDRB, SClk_Bit); // pin 13 is an output.bitClear
        bitClear(PORTB, SClk_Bit); // Clock starts low.bitSet
        bitClear(DDRB, MISO_Bit); // MOSI is low
    }
    unsigned int SW_SPI()
    {
        unsigned int Output;
        bitClear(PORTC, CS_Bit); // Chip Select low.
        for (int i = 15; i >= 0; i--)
        {
            bitSet(PORTB, SClk_Bit); // clock high
            if ( PINB & 0x010)   // OR digitalRead( MISO_Pin )
            {
                bitWrite( Output, i, 1 );
            }
            else
            {
                bitWrite( Output, i, 0 );
            }
            bitClear(PORTB, SClk_Bit); // Clock low.
        }
        bitSet(PORTC, CS_Bit); // cs off
        return Output;
    }// End of SW_SPI
    
    unsigned long ButtonTimer, ClkTimer;
    int encoderPosition;
    float TempBits1;
    float TempBits2;
    float ReadTemperature()
    {
        TempBits1 = ((SW_SPI() >> 3) & 0x0fff);
        float Temperature = 0.25 * (float) TempBits1;
        return Temperature; //C
    }
    void setup()
    {
        SW_SPI_Initialize();
        ButtonInitialize(4);
        EncoderInitialize();
        ButtonTimer = millis();
        lcd.begin(16, 2);
        lcd.clear();
        Serial.begin(9600);
        ClkTimer = millis();
        count = 10;
        EncoderValueT = EncoderValue;
    }
  • example3

    #include <stdint.h>
    #include <avr/io.h>
    
    /* default pins */
    #define SOFTSPI_CLK_DDR DDRD
    #define SOFTSPI_CLK_PORT PORTD
    #define SOFTSPI_CLK_MASK (1 << 3)
    #define SOFTSPI_MOSI_DDR DDRD
    #define SOFTSPI_MOSI_PORT PORTD
    #define SOFTSPI_MOSI_MASK (1 << 4)
    
    #ifndef SOFTSPI_DONT_USE_MISO
    #define SOFTSPI_DONT_USE_MISO 0
    #endif
    
    #if (SOFTSPI_DONT_USE_MISO == 0)
    #define SOFTSPI_MISO_DDR DDRD
    #define SOFTSPI_MISO_PIN PIND
    #define SOFTSPI_MISO_MASK (1 << 5)
    #endif
    
    static void softspi_setup_master(void)
    {
      SOFTSPI_CLK_DDR |= SOFTSPI_CLK_MASK;
      SOFTSPI_MOSI_DDR |= SOFTSPI_MOSI_MASK;
    
    #if (SOFTSPI_DONT_USE_MISO == 0)
      SOFTSPI_MISO_DDR |= SOFTSPI_MISO_MASK;
    #endif
    }
    
    static inline void softspi_clk_low(void)
    {
      SOFTSPI_CLK_PORT &= ~SOFTSPI_CLK_MASK;
    }
    
    static inline void softspi_clk_high(void)
    {
      SOFTSPI_CLK_PORT |= SOFTSPI_CLK_MASK;
    }
    
    static inline void softspi_mosi_low(void)
    {
      SOFTSPI_MOSI_PORT &= ~SOFTSPI_MOSI_MASK;
    }
    
    static inline void softspi_mosi_high(void)
    {
      SOFTSPI_MOSI_PORT |= SOFTSPI_MOSI_MASK;
    }
    
    static inline void softspi_write_bit(uint8_t x, uint8_t m)
    {
      /* dac7554 samples at clock falling edge */
    
      /* 5 insns per bit */
    
      softspi_clk_high();
      if (x & m) softspi_mosi_high(); else softspi_mosi_low();
      softspi_clk_low();
    }
    
    static void softspi_write_uint8(uint8_t x)
    {
      /* transmit msb first, sample at clock falling edge */
    
      softspi_write_bit(x, (1 << 7));
      softspi_write_bit(x, (1 << 6));
      softspi_write_bit(x, (1 << 5));
      softspi_write_bit(x, (1 << 4));
      softspi_write_bit(x, (1 << 3));
      softspi_write_bit(x, (1 << 2));
      softspi_write_bit(x, (1 << 1));
      softspi_write_bit(x, (1 << 0));
    }
    
    static inline void softspi_write_uint16(uint16_t x)
    {
      softspi_write_uint8((uint8_t)(x >> 8));
      softspi_write_uint8((uint8_t)(x & 0xff));
    }
    
    #if (SOFTSPI_DONT_USE_MISO == 0)
    
    static inline void softspi_read_bit(uint8_t* x, uint8_t i)
    {
      /* read at falling edge */
    
      softspi_clk_high();
    #if 0
    /* no need, atmega328p clock below 50mhz */
    /* softspi_wait_clk(); */
    #endif
      softspi_clk_low();
    
      if (SOFTSPI_MISO_PIN & SOFTSPI_MISO_MASK) *x |= 1 << i;
    }
    
    static uint8_t softspi_read_uint8(void)
    {
      /* receive msb first, sample at clock falling edge */
    
      /* must be initialized to 0 */
      uint8_t x = 0;
    
      softspi_read_bit(&x, 7);
      softspi_read_bit(&x, 6);
      softspi_read_bit(&x, 5);
      softspi_read_bit(&x, 4);
      softspi_read_bit(&x, 3);
      softspi_read_bit(&x, 2);
      softspi_read_bit(&x, 1);
      softspi_read_bit(&x, 0);
    
      return x;
    }
    
    static inline uint16_t softspi_read_uint16(void)
    {
      /* msB ordering */
      const uint8_t x = softspi_read_uint8();
      return ((uint16_t)x << 8) | (uint16_t)softspi_read_uint8();
    }
    
    #endif /* SOFTSPI_DONT_USE_MISO == 0 */

External IC

CDCE913

Clone this wiki locally