ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

顯示具有 MCU_P 標籤的文章。 顯示所有文章
顯示具有 MCU_P 標籤的文章。 顯示所有文章

2015年3月2日 星期一

STM32F4 Discovery board, in Debian Jessie

其實是follow : http://www.wolinlabs.com/blog/linux.stm32.discovery.gcc.html

結果:

啟動 stlink/st-util 時出現 error
2015-03-02T14:22:33 WARN src/stlink-usb.c: Error -3 (Permission denied) opening ST-Link/V2 device 001:003

結果是因為 /etc/udev/rules.d/45-usb-stlink-v3.rules 要加GROUPE:
# STLink Device
SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="3748", MODE="0666",GROUP="plugdev"


還有..

啟動 gdb 後..出現:
warning: File "/home/charles-chang/teatime/discovery/stm32_discovery_arm_gcc/blinky/.gdbinit" auto-loading has been declined
 by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
 add-auto-load-safe-path /home/charles-chang/teatime/discovery/stm32_discovery_arm_gcc/blinky/.gdbinit
line to your configuration file "/home/charles-chang/.gdbinit".
To completely disable this security protection add
 set auto-load safe-path /
line to your configuration file "/home/charles-chang/.gdbinit".

所以就 follow instruction, 在 home 下 create file: ~/.gdbinit
set auto-load safe-path /
就可以 auto-load.


然後是 ref: http://www.wolinlabs.com/blog/stm32f4.semihosting.html

這部份比較沒問題,就照著做,download & build openocd,
semihosting 的 example 在上面就已經download 好了 (git)
所以只要 build 就可以。

然後啟動 openocd, 再啟動 gdb,
semihosting 的 output 會顯示在 openocd 那一端。

* 有點問題的是,進 semihosting 後,用 回 stlink 好像有點問題。最後解決的方法是 nb 重開機..@_@

2013年3月14日 星期四

V-USB, software USB -- 用 GPIO 作

基於 V-USB 的一堆project/product


usb bootloader : http://www.fischl.de/avrusbboot/

一個 bootloade,利用 GPIO (JMP)作模式切換:normal boot 或 download。
download mode 時,會利用 V-USB 模擬一個 usb 1.1 device,所以可以經由 PC usb download hex,燒錄。
燒錄完成後就可以調整 gpio 作 normal boot。

... 那..第一次的 bootloader 要怎樣燒?


usb asp : http://www.fischl.de/usbasp/

利用 V-USB 和 pc 連接,經由自己的 usb protocol 控制 gpio,模擬成 SPI, I2C。


2010年8月23日 星期一

Worklog - MCU_P : uboot dev enviroment OK

nfs, mmc 都 OK 了 所以..現在可以開始 作u-boot function 的修改了。 server side
  • rebuild
  • copy to /var/lib/tftpboot
boar side
  • setenv ip,netmask,gateway,serverip
  • tftpboot 0xc2008000 u-boot.bin
  • cp.b 0xc2008000 0xf0004400 0x200000
重開,就可以了 重開的話,server 端的 usb0 要重新 setup. 接著來改 lcd display --- 希望可以 show splash..

2010年8月19日 星期四

uboot - network

uboot 的網路是從 環境變數 (env) 來取得網路參數的。 而且每個command 動作時,都會重新取一次。 所以,啟動後 setenv ipaddr 10.0.0.2 setenv netmask 255.255.255.9 setenv gateway 10.0.0.1 這樣 host 端: ifconfig usb0 10.0.0.1 netmask 255.255.255.0 up 就可以完成連線,然後: ping 10.0.0.1 checksum bad checksum bad host 10.0.0.1 is alive 代表 ping host OK
host 端可以修改 /etc/network/interfaces: auto usb0 iface usb0 inet static address 10.0.0.1 netmask 255.255.255.0 gateway 10.0.0.2

uboot - config and makefile , in a view of porting

mkconfig variant ARCH CPU BOARD VENDOR SOC 以 target smdk2410_config 來看: mkconfig smdk2410 arm arm920t smdk2410 NULL s3c24x0 所以
  • variant = smdk2410
  • ARCH = arm
  • CPU = arm920t
  • BOARD = smdk2410
  • VENDOR=
  • SOC = s3c24x0
這些variable 被使用:
  • create include/asm-CPU,, 建立 link 到 asm
  • 建立link include/asm-CPU 或 include/asm/asm-s3c24x0 到 asm-CPU/arch
  • create include/config.mk -- 定義 ARCH, CPU, BOARD, SOC
  • create include/config.h -- 產生內容: #include <configs/variabt.h> -- 所以重要的是 configs/variabt.h

所以要 porting uboot 要修改的部份有:
  • include/asm-CPU
  • include/asm-soc
  • include/configs/variant.h

Makefile 的部份: all : depends on u-boot u-boot depends on $(SUBDIRS) $(OBJS) $(LIBS) $(SUBDIRS), $(OBJS) 和 $(LIBS) 的 rule 都是簡單的 make 而已。 $(OBJS) 內都是 cpu/$(CPU)/ 下的 source 檔 $(LIBS) 除一般標準的 driver, disk rtc.. folde 外,還有 board/$(board)/lib$(board).a
所以 porting 時,還要create board/$(board) 目錄。 create 自己需要的 library
Makefile 的 include file:
  • include/config.mk --- 定義 ARCH, CPU, BOAD, VENDOR, SOC -- 這是標準的,不用改
  • config.mk -- 這也是標準的 rule,不用改 --
    • $(CPU)_config.mk -- 標準,不用改
    • cpu/$(CPU)/config.mk
    • cpu/$(CPU)/$(SOC)/config.mk
    • board/$(BOARD)/config.mk

所以porting時,要作自己的 cpu/$(CPU)/$(SOC)/config.mk 和 board/$(BOARD)/config.mk

2010年8月18日 星期三

uboot - config

build uboot 分為兩部份: config - build 一般的 software configure 都是 run ./configure 然後再 make 但是因為 uboot 是 build for target board,不是 host 所以 configure 是要把 uboot configure 成你的 target board. make tt2b_config 意思就是把uboot configure 成我的板子:tt2b 在 Makefile 中可以找到 tt2b_config 這個 target。 可以順便看一下其他的 XXX_config 大部分的 XXX_config 都是 call MKCONFIG... 多了: # include/asm # include/asm-arm/arch # include/asm-arm/proc # include/config.h # include/config.mk tt2b 這個 板子是去執行一個 shell script ...
  • 產生 include/config.h
  • 和其他人一樣,執行 MKCONFIG

所以來看一個 MKCONFIG.. tt2b 呼叫的 argument 是: $MKCONFIG -a tt2b arm arm1136 sssoc NULL sssoc 大概看一下.. mkconfig 這個 shell script 後面的 argument 分別是:
"-a" 一開始被 shift 掉.. 所以 tt2b 算 $1
echo "ARCH = $2" > config.mk echo "CPU = $3" >> config.mk echo "BOARD = $4" >> config.mk echo "VENDOR = $5" >> config.mk echo "SOC = $6" >> config.mk 第一個 argument "tt2b" 會被用在 新產生的 include/config.h 里: cd ./include echo "/* Automatically generated - do not edit */" >>config.h echo "#include <configs/$1.h>" >>config.h $2, $3 還被用來建 inlude/asm,, proc 的 folder link
所以 uboot 的 config 是用 mkconfig 這個 shell 來完成的。 他要產生
  • include/config.h
  • include/config.mk
  • include/asm

2010年8月17日 星期二

worklog - uboot of MCU_P

參考 bsp 下的 makefile, uboot 的 make rule. 可以看到 make $(BDNAME)_config然後去找 BDNAME (是 tt2cb) 在uboot/Makefile找到 tt2cb_config 的 rule : 是 board/vendor/ 下的 一個 shell script,他會去修改 include/config.h 接上 usb... boot uboot 時原來 USB0 Cable is not plugged-in 的 message 消失了。 在 linux host 上 dmesg : [1756640.022407] usb 4-3: USB disconnect, address 9 [1756645.672024] usb 4-3: new high speed USB device using ehci_hcd and address 10 [1756645.808028] hub 4-0:1.0: unable to enumerate USB device on port 3 [1756646.252023] usb 2-1: new full speed USB device using ohci_hcd and address 2 [1756647.500029] hub 2-0:1.0: unable to enumerate USB device on port 1 [1756653.972024] usb 4-3: new high speed USB device using ehci_hcd and address 11 [1756654.105202] usb 4-3: configuration #2 chosen from 1 choice [1756654.110595] usb 4-3: New USB device found, idVendor=105b, idProduct=9030 [1756654.110602] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [1756654.110605] usb 4-3: Product: bd2x0bd [1756654.110608] usb 4-3: Manufacturer: Sxxx [1756654.110610] usb 4-3: SerialNumber: 0 [1756654.363827] cdc_acm: This device cannot do calls on its own. It is no modem. [1756654.364055] cdc_acm 4-3:2.0: ttyACM0: USB ACM device [1756654.366357] usbcore: registered new interface driver cdc_acm[1756654.366365] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters list installed module 來看..多了 cdc_acm 這個 driver/module. 查一下 include/configs/tt2b.h有定義 #define CONFIG_USB_TTY 0 /* Controller USB0 */ #define CONFIG_USB_ETHER 1 /* Controller USB1 */ 所以知道 Rx6 的 usb port 是 usb0 -- 從 uboot 消失的 message 可以知道。所以是 USB_TTY。 所以 driver 是 cdc_acm. 變更一下,把 USB0 改作 ETHER.. 開機dmesg: [1757943.195445] usb 4-3: New USB device found, idVendor=105b, idProduct=9030 [1757943.195451] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [1757943.195454] usb 4-3: Product: bd2x0bd [1757943.195457] usb 4-3: Manufacturer: SiRF [1757943.195459] usb 4-3: SerialNumber: 0 [1757944.330011] usb 4-3: USB disconnect, address 13 [1758205.148026] usb 4-3: new high speed USB device using ehci_hcd and address 14 [1758205.281250] usb 4-3: configuration #1 chosen from 1 choice [1758205.286289] usb 4-3: New USB device found, idVendor=105b, idProduct=9030 [1758205.286296] usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [1758205.286299] usb 4-3: Product: bd2x0bd [1758205.286302] usb 4-3: Manufacturer: SiRF [1758205.486224] usb0: register 'cdc_ether' at usb-0000:00:0f.3-3, CDC Ethernet Device, 1e:6e:37:bc:8a:47 [1758205.486251] usbcore: registered new interface driver cdc_ether lsmod 果然就有 cdc_ether,ifconfig 則增加了: usb0 Link encap:Ethernet HWaddr 1e:6e:37:bc:8a:47 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:90 (90.0 B)

2010年8月16日 星期一

worklog - nboot of MCU_P

看起來 linux 跟 ce 的 nboot 是一樣的,就是根據 TOC 的 entry 資料 load 一定 size 的 sector 進 memory .. TOC_START_BLOCK=0x21 g_dwTOCBlock=0x21 g_dwTOCBlockSize=0x1 g_dwEBootBlock=0x22 g_dwEBootblocksize=0x1000 g_dwDMBlock=0x1022 g_dwDMBlocksize=0x480 g_dwSecureBlock=0x14A2 g_dwSecureBlocksize=0x4 g_dwLOGOBlock=0x14A6 g_dwLOGOBlocksize=0x1FE g_dwNKBlock=0x16A4 TOC update 配合 program nboot.bin, uboot.bin 到 sd 的 shell script 來看 sd card 的配置:
  • nboot : sector 1 ~ 32
  • TOC : 33
  • uboot : 34 ~ (34+4096)
其他的 loading data: Jumpto image:0x0 Sector Needed 0x1000 dwRAM: 0x8D000000 JumpAddr: 0xC1000000 startsect=0x22 dwNumSectors=0x1000 dwRAM=0x8D000000 Jumpto:0xC1000000 Preparing System for Linux Kernel Boot
對照 CE 的 boot log: start Address: 0x22 Load Address: 0x8C01A000 Jump Address: 0x8C01A000 Ttl Sectors: 0x180 Chain in TOC: Chain Load Addr: 0x0 startsect=0x22 dwNumSectors=0x180 dwRAM=0x8C01A000 Jumpto:0xC001A000 所以差異是在 ram 的 address 上..
這個 default TOC 是在 nboot 啟動後寫入的: ce 版: Reset TOC @@@@ g_pTOC is not valid, init it @@@@ TOC_START_BLOCK=0x21 g_dwTOCBlock=0x21 g_dwTOCBlockSize=0x1 g_dwEBootBlock=0x22 g_dwEBootblocksize=0x180 g_dwDMBlock=0x1A2 g_dwDMBlocksize=0x0 g_dwSecureBlock=0x1A2 g_dwSecureBlocksize=0x4 g_dwLOGOBlock=0x1A6 g_dwLOGOBlocksize=0x1FE g_dwNKBlock=0x3A4 TOC updateTOC update 決定 nboot payload - eboot/uboot 的 預留空間size是 predefine 的, linux 和 ce 在這裡不一樣:
  • CE : 0x30000
  • Linux: 0x200000 (2M ? 實際上看 u-boot 真的要 1.6M..)

果然,修改 EBOOT_RAM_IMAGE_SIZE 之類的就可以..
%CSPCOMMONPATH%\INC\loader.h
  • EBOOT_RAM_IMAGE_BASE 0x8D000000
  • EBOOT_RAM_IMAGE_SIZE 0x00030000
  • EBOOT_RESERVED_SIZE 0x200000
其中最後一個:EBOOT_RESERVED_SIZE 的大小就是使用 vendor 不open source 的 download tool download uboot 時,需要的空間。不改的話,會有 error.

標籤

網誌存檔