SAME70-xplained Linux noMMU

This forum is for users of Atmel's SAM Series and who are interested in using Linux OS.

Moderator: nferre

szemzoa
Posts: 9
Joined: Thu Jun 18, 2015 3:49 pm

SAME70-xplained Linux noMMU

Fri Mar 11, 2016 6:15 pm

Hi,

It was only a proof of concept project, you can do nothing really useful with 2MB ram, but it's quite possible to run noMMU linux on this CPU.
It's booting under 1 sec to console.

I wrote a very small bootloader (3kb), the kernel is running XIP from the CPU's internal 2MB flash. DTB is in flash too. Filesystem is
in RAM, it's about 150KB, really just a "one man army" busybox :).

It was a fun learning experience (and a few JTAG days).
I'll make a new PCB based on this CPU (the 512KB flash part), with more SDRAM, and serial NOR or serial NAND flash connected to QSPI.
Will be an all TQFP, easy to solder/home made cheap IoT Linux board.
(Also with good documentation of the cpu internals...khm)

This CPU is a really nice piece of HW.

0.000000] Linux version 4.4.3 (root@debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #191 PREEMPT Fri Mar 11 16:4
1:47 CET 2016
[ 0.000000] CPU: ARMv7-M [410fc271] revision 1 (ARMv7M), cr=00000000
[ 0.000000] CPU: unknown data cache, unknown instruction cache
[ 0.000000] Machine model: ATMEL SAME70-xplained board
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping off. Total pages: 508
[ 0.000000] Kernel command line: console=ttyS1,115200 ihash_entries=64 dhash_entries=64 root=/dev/ram init=/sbin/init
[ 0.000000] PID hash table entries: 16 (order: -6, 64 bytes)
[ 0.000000] Dentry cache hash table entries: 64 (order: -4, 256 bytes)
[ 0.000000] Inode-cache hash table entries: 64 (order: -4, 256 bytes)
[ 0.000000] Memory: 1888K/2048K available (674K kernel code, 35K rwdata, 216K rodata, 48K init, 51K bss, 160K 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 : 0x70000000 - 0x70200000 ( 2 MB)
[ 0.000000] .text : 0x00440000 - 0x0051ec54 ( 892 kB)
[ 0.000000] .init : 0x7000a000 - 0x7000d000 ( 12 kB)
[ 0.000000] .data : 0x70008000 - 0x70013f40 ( 48 kB)
[ 0.000000] .bss : 0x70013f40 - 0x70020e4c ( 52 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Preemptible * RCU implementation.
[ 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: 49772404 ns
[ 0.000000] ARM System timer initialized as clocksource
[ 0.000000] SAME70 RTT initialized as clockevent driver
[ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
[ 0.050000] Calibrating delay loop... 600.47 BogoMIPS (lpj=3002368)
[ 0.050000] pid_max: default: 4096 minimum: 301
[ 0.050000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.050000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.060000] devtmpfs: initialized
[ 0.070000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.100000] clocksource: Switched to clocksource arm_system_timer
[ 0.390000] 40028000.serial: ttyS1 at MMIO 0x40028000 (irq = 17, base_baud = 9375000) is a ATMEL_SERIAL
[ 0.580000] console [ttyS1] enabled
[ 0.600000] devtmpfs: mounted
[ 0.600000] Freeing unused kernel memory: 12K (7000a000 - 7000d000)
init started: BusyBox v1.24.1 (2016-03-11 16:36:11 CET)
starting pid 17, tty '': '/bin/mount -t proc proc /proc'
starting pid 18, tty '': '/bin/mkdir -p /dev/pts'
starting pid 19, tty '': '/bin/mkdir -p /dev/shm'
starting pid 20, tty '': '/bin/mount -a'
starting pid 21, tty '': '/bin/cat /proc/cpuinfo'
processor : 0
model name : ARMv7-M rev 1 (v7ml)
BogoMIPS : 600.47
Features : half thumb fastmult idivt
CPU implementer : 0x41
CPU architecture: 7M
CPU variant : 0x0
CPU part : 0xc27
CPU revision : 1

Hardware : ATMEL SAME70 (Device Tree Support)
Revision : 0000
Serial : 0000000000000000
starting pid 22, tty '/dev/ttyS1': '/sbin/getty -L ttyS1 0 vt100'

Welcome to Buildroot
(none) login:
szemzoa
Posts: 9
Joined: Thu Jun 18, 2015 3:49 pm

Re: SAME70-xplained Linux noMMU

Fri Nov 11, 2016 3:06 pm

Going slowly as a hobby project, but almost there :) :

x7-boot v0.3
SD/MMC: Image: Read file uImage to 0x70007FC0
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: dt blob: Read file same70-sampione.dtb to 0x71000000

starting application at 0x70008001

Booting Linux on physical CPU 0x0
Linux version 4.9.0-rc3 (root@debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #53 PREEMPT Wed Nov 9 19:47:53 CET 2016
CPU: ARMv7-M [410fc271] revision 1 (ARMv7M), cr=00000000
CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
OF: fdt:Machine model: SAME70-sampione board
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttyS1,115200 root=/dev/mmcblk0p2 rw init=/linuxrc rootwait
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 62228K/65536K available (1733K kernel code, 91K rwdata, 460K rodata, 80K init, 136K bss, 3308K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0x00000000 - 0x00001000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0x00000000 - 0xffffffff (4095 MB)
lowmem : 0x70000000 - 0x74000000 ( 64 MB)
modules : 0x70000000 - 0x74000000 ( 64 MB)
.text : 0x70008000 - 0x701b9558 (1734 kB)
.init : 0x70246000 - 0x7025a000 ( 80 kB)
.data : 0x7025a000 - 0x70270f20 ( 92 kB)
.bss : 0x70270f20 - 0x70293300 ( 137 kB)
Preemptible * RCU implementation.
Build-time adjustment of leaf fanout to 32.
NR_IRQS:16 nr_irqs:16 16
clocksource: tcb_clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 101933890472 ns
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
Calibrating delay loop... 574.66 BogoMIPS (lpj=2873344)
pid_max: default: 4096 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
AT91: Detected SoC family: samx7
AT91: Detected SoC: same70q20, revision 0
gpio-at91 400e0e00.gpio: at address 400e0e00
gpio-at91 400e1000.gpio: at address 400e1000
gpio-at91 400e1200.gpio: at address 400e1200
gpio-at91 400e1400.gpio: at address 400e1400
gpio-at91 400e1600.gpio: at address 400e1600
pinctrl-at91 soc:pinctrl@0x400e0e00: initialized AT91 pinctrl driver
at_xdmac 40078000.dma-controller: 24 channels, mapped at 0x40078000
at91_i2c 40018000.i2c: using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
at91_i2c 40018000.i2c: AT91 i2c bus driver (hw version: 0x610).
at91_i2c 40060000.i2c: using dma0chan2 (tx) and dma0chan3 (rx) for DMA transfers
at91_i2c 40060000.i2c: AT91 i2c bus driver (hw version: 0x610).
clocksource: Switched to clocksource tcb_clksrc
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
workingset: timestamp_bits=30 max_order=14 bucket_order=0
io scheduler noop registered (default)
40024000.serial: ttyS0 at MMIO 0x40024000 (irq = 42, base_baud = 9375000) is a ATMEL_SERIAL
40028000.serial: ttyS1 at MMIO 0x40028000 (irq = 43, base_baud = 9375000) is a ATMEL_SERIAL
console [ttyS1] enabled
400e0800.serial: ttyS3 at MMIO 0x400e0800 (irq = 44, base_baud = 9375000) is a ATMEL_SERIAL
400e0a00.serial: ttyS4 at MMIO 0x400e0a00 (irq = 45, base_baud = 9375000) is a ATMEL_SERIAL
400e1a00.serial: ttyS5 at MMIO 0x400e1a00 (irq = 46, base_baud = 9375000) is a ATMEL_SERIAL
loop: module loaded
atmel_qspi 4007c000.qspi: n25q512ax3 (65536 Kbytes)
3 ofpart partitions found on MTD device 4007c000.qspi
Creating 3 MTD partitions on "4007c000.qspi":
0x000000000000-0x000000400000 : "qspi-linux-kernel"
0x000000400000-0x000000420000 : "qspi-device-tree"
0x000000420000-0x000004000000 : "qspi-rootfs"
atmel_spi 40008000.spi: version: 0x232
atmel_spi 40008000.spi: Using dma0chan4 (tx) and dma0chan5 (rx) for DMA transfers
atmel_spi 40008000.spi: Using FIFO (0 data)
atmel_spi 40008000.spi: Atmel SPI Controller at 0x40008000 (irq 37)
libphy: Fixed MDIO Bus: probed
CAN device driver interface
m_can 40030000.can: m_can device registered (regs=40030000, irq=40)
macb 40050000.ethernet: invalid hw address, using random
libphy: MACB_mii_bus: probed
NS DP83848C 10/100 Mbps PHY 40050000.etherne:01: attached PHY driver [NS DP83848C 10/100 Mbps PHY] (mii_bus:phy_addr=40050000.etherne:01, irq=123)
macb 40050000.ethernet eth0: Cadence GEM rev 0x00020203 at 0x40050000 irq 33 (aa:0a:28:c0:3b:bc)
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP Deflate Compression module registered
rtc rtc0: alarm rollover not handled
rtc rtc0: invalid alarm value: 1900-1-1 0:0:0
at91_rtc 400e1860.rtc: rtc core: registered 400e1860.rtc as rtc0
at91_rtc 400e1860.rtc: AT91 Real Time Clock driver.
i2c /dev entries driver
AT91: Starting after general reset
at91sam9_wdt: enabled (heartbeat=8 sec, nowayout=0)
atmel_mci 40000000.mmc: version: 0x600
atmel_mci 40000000.mmc: using dma0chan6 for DMA transfers
atmel_mci 40000000.mmc: Atmel MCI controller at 0x40000000 irq 36, 1 slots
random: fast init done
atmel_aes 4006c000.aes: version: 0x201
atmel_aes 4006c000.aes: Atmel AES - Using dma0chan7, dma0chan8 for DMA transfers
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20160617 t)
can: netlink gateway (rev 20130117) max_hops=1
mmc0: host does not support reading read-only switch, assuming write-enable
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SL08G 7.40 GiB
mmcblk0: p1 p2
at91_rtc 400e1860.rtc: setting system clock to 2012-01-01 00:00:04 UTC (1325376004)
atmel_usart 40028000.serial: using dma0chan9 for rx DMA transfers
atmel_usart 40028000.serial: using dma0chan10 for tx DMA transfers
EXT2-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 80K (70246000 - 7025a000)
This architecture does not have kernel memory protection.
Starting logging: OK
Initializing random number generator... done.
Starting network...
Starting inetd: OK

Welcome to Buildroot
buildroot login: macb 40050000.ethernet eth0: link up (100/Full)
buildroot login: root
Password:

~ # cat /proc/cpuinfo
processor : 0
model name : ARMv7-M rev 1 (v7ml)
BogoMIPS : 574.66
Features : half thumb fastmult edsp idivt
CPU implementer : 0x41
CPU architecture: 7M
CPU variant : 0x0
CPU part : 0xc27
CPU revision : 1

Hardware : Atmel SAMx7
Revision : 0000
Serial : 0000000000000000

~ # cat /proc/interrupts
CPU0
18: 28835 nvic_irq 25 Edge tc_clkevt
28: 152 nvic_irq 58 Edge at_xdmac
29: 2 nvic_irq 43 Edge 4007c000.qspi
30: 0 nvic_irq 56 Edge atmel-aes
31: 0 nvic_irq 19 Edge 40018000.i2c
32: 0 nvic_irq 41 Edge 40060000.i2c
33: 6 nvic_irq 39 Edge eth0
34: 0 nvic_irq 66 Edge eth0
35: 0 nvic_irq 67 Edge eth0
36: 572 nvic_irq 18 Edge 40000000.mmc
37: 0 nvic_irq 21 Edge 40008000.spi
39: 1 nvic_irq 2 Edge at91_rtc
43: 768 nvic_irq 14 Edge ttyS1
123: 3 GPIO 11 Edge phy_interrupt
Err: 0

~ # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=1.168 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=4.025 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=3.790 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=3.813 ms
64 bytes from 192.168.1.1: seq=4 ttl=64 time=3.975 ms
64 bytes from 192.168.1.1: seq=5 ttl=64 time=3.776 ms
64 bytes from 192.168.1.1: seq=6 ttl=64 time=0.816 ms
^C
--- 192.168.1.1 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 0.816/3.051/4.025 ms

~ # ubiattach -m 2 /dev/ubi_ctrl
ubi0: default fastmap pool size: 45
ubi0: default fastmap WL pool size: 22
ubi0: attaching mtd2
ubi0: scanning is finished
ubi0: attached mtd2 (name "qspi-rootfs", size 59 MiB)
ubi0: PEB size: 65536 bytes (64 KiB), LEB size: 65408 bytes
ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1
ubi0: VID header offset: 64 (aligned 64), data offset: 128
ubi0: good PEBs: 958, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 5/3, WL threshold: 4096, image sequence number: 164107579
ubi0: available PEBs: 0, total reserved PEBs: 958, PEBs reserved for bad PEB handling: 0
ubi0: background thread "ubi_bgt0d" started, PID 109
UBI device number 0, total 958 LEBs (62660864 bytes, 59.8 MiB), available 0 LEBs (0 bytes), LEB size 65408 bytes (63.9 KiB)

~ # mount -t ubifs ubi0:rootfs /mnt
UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 111
UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS (ubi0:0): LEB size: 65408 bytes (63 KiB), min./max. I/O unit sizes: 8 bytes/256 bytes
UBIFS (ubi0:0): FS size: 61614336 bytes (58 MiB, 942 LEBs), journal size 3074176 bytes (2 MiB, 47 LEBs)
UBIFS (ubi0:0): reserved for root: 2910196 bytes (2841 KiB)
UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 68431122-46B9-49BC-9944-5396A7C100E5, small LPT model

~ # df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 7.2G 82.9M 6.7G 1% /
ubi0:rootfs 52.4M 3.7M 45.9M 8% /mnt
~ #
davidluca3000
Posts: 1
Joined: Sun Aug 13, 2017 5:24 pm

Re: SAME70-xplained Linux noMMU

Sun Aug 13, 2017 5:48 pm

I don't suppose you have this code somewhere available on GitHub? I'm having instability problems with SDRAM settings, was wondering what timings and initialization procedure did you use? In the datasheet doesn't say which clock is assigned to SDRAMC.
Best regards,
David.
szemzoa
Posts: 9
Joined: Thu Jun 18, 2015 3:49 pm

Re: SAME70-xplained Linux noMMU

Wed Aug 30, 2017 8:42 am

No, I don't uploaded it to github yet, but if you need I can send my bootloader in PM.
I have a version with a ported memtester linux application also.

There is indeed a 'feature'/bug/etc in the SoC MCK/PLL clock system.
My board is running linux fine for >3 weeks, or running memtester for days without a single failure with 300MHz CPU and 150MHz SDRAM clock, so my SDRAM setup, PCB routing is OK.

But for this, I had to use 150MHz MCK, 300MHz HCLK, AND 600MHz PLL clock.
If I try to generate the MCK and CPU clock from 300MHz PLL, it will generate SDRAM failures
under load withing a few minutes.

So in the first place I think you should try the same.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest