User:A faerber/SK-FM4-176L-S6E2CC

Jump to: navigation, search

Linux port

First presented at LinuxCon Japan 2015: Pushing the limits of Linux on ARM (slide 20)

Note that openSUSE will not run on this board as it is an ARMv7-M microcontroller.

Bootloader

afboot-fm4

Kernel

https://github.com/afaerber/linux/commits/fm4

Implemented based on next-20150521 (4.1.0-rc4):

  • mach-fm4
  • low-level debug support
  • Device Tree
  • clocksource driver
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.1.0-rc4-next-20150521+ (andreas@envy.lan) (gcc version 4.9.3 20150303 (release) [ARM/embedded-4_9-branch revision 221220] (GNU Tools for ARM Embedded Processors) ) #12 PREEMPT Thu Jul 2 04:47:53 CEST 2015
[    0.000000] CPU: ARMv7-M [410fc241] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Spansion SK-FM4-176L-S6E2CC
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 508
[    0.000000] Kernel command line: earlyprintk
[    0.000000] PID hash table entries: 16 (order: -6, 64 bytes)
[    0.000000] Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Memory: 1832K/2048K available (752K kernel code, 37K rwdata, 228K rodata, 49K init, 89K bss, 216K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0x00000000 - 0x00001000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
[    0.000000]     lowmem  : 0x60000000 - 0x60200000   (   2 MB)
[    0.000000]       .text : 0x00004000 - 0x000fa408   ( 986 kB)
[    0.000000]       .init : 0x6000a000 - 0x6000d000   (  12 kB)
[    0.000000]       .data : 0x60008000 - 0x60014860   (  51 kB)
[    0.000000]        .bss : 0x60014860 - 0x6002ae18   (  90 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Additional per-CPU info printed with stalls.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] clocksource arm_system_timer: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 37329303 ns
[    0.000000] ARM System timer initialized as clocksource
[    0.000000] Dual Timer
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
[    0.000000] Calibrating delay loop... 60.62 BogoMIPS (lpj=303104)
[    0.100000] pid_max: default: 4096 minimum: 301
[    0.120000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.130000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.270000] devtmpfs: initialized
[    0.340000] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.630000] Switched to clocksource arm_system_timer
[    1.280000] io scheduler noop registered (default)
[    1.340000] bootconsole [earlycon0] disabled

Userspace

Not prepared yet. openSUSE is not available for ARMv7-M.

JTAG

OpenOCD

Board config board/spansion_sk-fm4-176l-s6e2cc.cfg available from OpenOCD 0.9.0 on (Tumbleweed).

Flash driver in progress:

flash 'fm4' found at 0x00000000
#0 : fm4 at 0x00000000, size 0x0020a000, buswidth 0, chipwidth 0
	#  0: 0x00000000 (0x2000 8kB) protection state unknown
	#  1: 0x00002000 (0x2000 8kB) protection state unknown
	#  2: 0x00004000 (0x2000 8kB) protection state unknown
	#  3: 0x00006000 (0x2000 8kB) protection state unknown
	#  4: 0x00008000 (0x8000 32kB) protection state unknown
	#  5: 0x00010000 (0x10000 64kB) protection state unknown
	#  6: 0x00020000 (0x10000 64kB) protection state unknown
	#  7: 0x00030000 (0x10000 64kB) protection state unknown
	#  8: 0x00040000 (0x10000 64kB) protection state unknown
	#  9: 0x00050000 (0x10000 64kB) protection state unknown
	# 10: 0x00060000 (0x10000 64kB) protection state unknown
	# 11: 0x00070000 (0x10000 64kB) protection state unknown
	# 12: 0x00080000 (0x10000 64kB) protection state unknown
	# 13: 0x00090000 (0x10000 64kB) protection state unknown
	# 14: 0x000a0000 (0x10000 64kB) protection state unknown
	# 15: 0x000b0000 (0x10000 64kB) protection state unknown
	# 16: 0x000c0000 (0x10000 64kB) protection state unknown
	# 17: 0x000d0000 (0x10000 64kB) protection state unknown
	# 18: 0x000e0000 (0x10000 64kB) protection state unknown
	# 19: 0x000f0000 (0x10000 64kB) protection state unknown
	# 20: 0x00100000 (0x2000 8kB) protection state unknown
	# 21: 0x00102000 (0x2000 8kB) protection state unknown
	# 22: 0x00104000 (0x2000 8kB) protection state unknown
	# 23: 0x00106000 (0x2000 8kB) protection state unknown
	# 24: 0x00108000 (0x8000 32kB) protection state unknown
	# 25: 0x00110000 (0x10000 64kB) protection state unknown
	# 26: 0x00120000 (0x10000 64kB) protection state unknown
	# 27: 0x00130000 (0x10000 64kB) protection state unknown
	# 28: 0x00140000 (0x10000 64kB) protection state unknown
	# 29: 0x00150000 (0x10000 64kB) protection state unknown
	# 30: 0x00160000 (0x10000 64kB) protection state unknown
	# 31: 0x00170000 (0x10000 64kB) protection state unknown
	# 32: 0x00180000 (0x10000 64kB) protection state unknown
	# 33: 0x00190000 (0x10000 64kB) protection state unknown
	# 34: 0x001a0000 (0x10000 64kB) protection state unknown
	# 35: 0x001b0000 (0x10000 64kB) protection state unknown
	# 36: 0x001c0000 (0x10000 64kB) protection state unknown
	# 37: 0x001d0000 (0x10000 64kB) protection state unknown
	# 38: 0x001e0000 (0x10000 64kB) protection state unknown
	# 39: 0x001f0000 (0x10000 64kB) protection state unknown
	# 40: 0x00406000 (0x2000 8kB) protection state unknown
	# 41: 0x00408000 (0x2000 8kB) protection state unknown
	# 42: 0x0040a000 (0x2000 8kB) protection state unknown
	# 43: 0x0040c000 (0x2000 8kB) protection state unknown
	# 44: 0x0040e000 (0x2000 8kB) protection state unknown
S6E2CCA
auto erase enabled
Info : Spansion S6E2CC erase sectors 1 to 1
Info : Spansion S6E2CC write at 0x00002000 (8192)
Info : copying 8192 bytes to SRAM 0x1ffd005c
Info : writing 0x00002000-0x00003fff (4096x)
wrote 8192 bytes from file arch/arm/boot/dts/fm4-sk-176l-s6e2cc.dtb in 1.699034s (4.709 KiB/s)

Patch: http://openocd.zylin.com/#/c/2190/

USB interface

Firmware v23

# lsusb -d 1a6a:2000 -v
Bus 002 Device 009: ID 1a6a:2000 Spansion Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.01
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1a6a Spansion Inc.
  idProduct          0x2000 
  bcdDevice            1.60
  iManufacturer           1 Spansion
  iProduct                2 Spansion CMSIS-DAP + COM Port
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          107
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x00
      (Missing must-be-set bit!)
      (Bus Powered)
    MaxPower               62mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              4 Spansion CMSIS-DAP
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      29
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         1
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               5 Spansion USB Serial Port
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0 
      CDC Header:
        bcdCDC               10.01
      CDC ACM:
        bmCapabilities       0x00
      CDC Union:
        bMasterInterface        1
        bSlaveInterface         2 
      CDC Call Management:
        bmCapabilities       0x01
          call management
        bDataInterface          2
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval             255
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

Original firmware

$ lsusb -d 1a6a:2000 -v

Bus 002 Device 005: ID 1a6a:2000 Spansion Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.01
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x1a6a Spansion Inc.
  idProduct          0x2000 
  bcdDevice            1.60
  iManufacturer           1 Spansion
  iProduct                2 Spansion CMSIS-DAP + COM Port
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           93
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x00
      (Missing must-be-set bit!)
      (Bus Powered)
    MaxPower               62mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              4 Spansion CMSIS-DAP
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      29
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         1
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               5 Spansion USB Serial Port
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0 
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval             255
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)