├── AT91SAM9N12 ├── AT91_Bootstrap.md ├── Contributing_Kernel.md ├── FinalThoughts.md ├── Networking.md ├── OldSchool │ ├── at91-bootstrap │ │ ├── .config │ │ ├── 0001-Changed-128MB-to-64MB-of-DRAM.patch │ │ ├── 0002-Dropped-DRAM-MCLK-from-133-Mhz-to-100-Mhz.patch │ │ ├── 0003-Relaxed-DRAM-timings-and-changed-8-to-4-banks.patch │ │ ├── 0004-Added-debug-prompts-to-SPI-init-MCLK-SPI-speed-etc.patch │ │ ├── 0005-Added-memory-tests-and-more-debug-prompts-to-main.patch │ │ └── readme.md │ ├── busybox │ │ ├── Config.in │ │ └── readme.md │ ├── gists │ │ ├── Crosstools-NG-output.txt │ │ ├── GCC-compilation.txt │ │ ├── Large-Mem-Test.txt │ │ ├── USB-working-in-U-Boot.txt │ │ ├── Verifying Busybox execution.txt │ │ ├── added-inittab-to-Busybox.txt │ │ ├── added-scripted-boot-to-U-Boot.txt │ │ ├── first-GCC-attempt.txt │ │ ├── initial-working-U-Boot.txt │ │ ├── kernel-booting-without-rootfs.txt │ │ ├── more-memtests.txt │ │ ├── readme.md │ │ ├── rough-memtests-added-to-at91-bootstrap.txt │ │ ├── sodoku-execution.txt │ │ ├── spamming-missing-serial-port.txt │ │ └── verifying-Busybox-execution.txt │ ├── linux │ │ └── readme.md │ ├── readme.md │ ├── root_file_sys │ │ ├── gen_rootfs.sh │ │ ├── readme.md │ │ └── rootfs_additions │ │ │ └── usr │ │ │ └── home │ │ │ ├── cross_tool_bins │ │ │ ├── Sodoku_crosstools_dyn │ │ │ ├── hello_cross_tool_dyn │ │ │ └── hello_cross_tool_static │ │ │ └── hello_world │ │ │ └── main.cpp │ └── u-boot │ │ ├── 0001-Relocating-U-Boot-change-128-to-64MB-USB-boot.patch │ │ └── readme.md ├── Packages.md ├── SAMBA.md ├── USB.md ├── buildroot.md ├── configs │ ├── BrainyV2.dts │ ├── BrainyV2_AT91Bootstrap.bin │ ├── BrainyV2_AT91Bootstrap_defconfig │ ├── BrainyV2_buildroot_full_defconfig │ ├── BrainyV2_buildroot_minimal_defconfig │ ├── BrainyV2_kernel_defconfig │ ├── USB-Bogus-Pipe-warning-rate-limited.patch │ ├── clk-at91-PLL-recalc_rate-now-using-cached-MUL-and-DI.patch │ ├── full │ │ ├── BrainyV2.dtb │ │ ├── rootfs.squashfs │ │ └── zImage │ └── minimal │ │ ├── BrainyV2.dtb │ │ ├── rootfs.squashfs │ │ └── zImage ├── devicetree.md ├── hardware │ ├── Documentation_Final.PDF │ ├── SPI_Breakout.PDF │ ├── SPI_ConnectionPDF.PDF │ └── Support_Board.PDF ├── images │ ├── AT91Bootstrap_CMDArgs.PNG │ ├── AT91Bootstrap_Flash.PNG │ ├── AT91Bootstrap_menuconfig.PNG │ ├── BGA_Pad_Issue.jpg │ ├── BrainyV3_Back.jpg │ ├── BrainyV3_Front.jpg │ ├── Buildroot_Example.PNG │ ├── Buildroot_Kernel_Module.PNG │ ├── DSC_9624_S.jpg │ ├── DSC_9625_S.jpg │ ├── DSC_9626_S.jpg │ ├── DSC_9629_S.jpg │ ├── Enumerate_Fail_packet.PNG │ ├── Enumerate_Fail_packet_Small.png │ ├── Enumerate_Fail_singlebit.PNG │ ├── Enumerate_Fail_singlebit_Small.png │ ├── IMG_20180321_031355.jpg │ ├── Linux_ath9k_search.PNG │ ├── RK3399_Taobao.PNG │ ├── RootFS_Size0.PNG │ ├── SAM-BA_DRAM.PNG │ └── SAM-BA_Dataflash.PNG ├── readme.md ├── replicate.md └── smallerzimage.md ├── DSC_9296.jpg ├── MX233 ├── gists │ ├── BCB-to-SD-card-with-image.sh │ ├── BCB-to-SD-card.sh │ ├── OSH-4-layer-renaming.sh │ ├── UART-recovery-mode-log.txt │ ├── gen-a-BCB.cpp │ ├── initial-4-layer-redo-boot-log.txt │ ├── mem-test-failure.txt │ └── readme.md ├── hardware │ └── MX_233_Linux.PDF ├── images │ ├── DSC_9621_S.jpg │ └── DSC_9631_S.jpg ├── readme.md └── scripts │ ├── imx_bootlets │ ├── compile_and_write.sh │ ├── create_updater.sh │ ├── display.sh │ └── wipe.sh │ └── jancc │ ├── clean.sh │ ├── copy_to_sdcard.sh │ └── master_script.sh ├── SUMMARY.md ├── book.json └── readme.md /AT91SAM9N12/AT91_Bootstrap.md: -------------------------------------------------------------------------------- 1 | # AT91 Bootstrap 2 | 3 | In addition to SAM-BA, Atmel released AT91 Bootstrap, a secondary bootloader which handles clocking, DRAM initialization, and can even boot the Linux kernel directly without the need for U-Boot. They also made some good [documentation](http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap) on it, though I found the code itself to be fairly messy and poorly documented. Heck, it's even written in C89 style where all the variables are at the top of functions and using ```for(i = 0; i < 100; i++)``` instead of style ```for(int i = 0; i < 100; i++)``` for loops. 4 | 5 | Our first goal is to just get bootstrap both compiling and running on the board, after which comes the Linux kernel and busybox. 6 | 7 | ## Configuring 8 | 9 | To download the source code of AT91 Bootstrap and configure it, just do a git clone; 10 | 11 | ```bash 12 | # Clone the git repo of AT91 Bootstrap 13 | git clone https://github.com/linux4sam/at91bootstrap.git 14 | 15 | # Enter the directory of the git repo 16 | cd at91bootstrap 17 | ``` 18 | 19 | This software by Atmel, and almost all other larger codebases that run on bare metal, use kconfig to configure itself (works with define's in C/C++ code and other various configuration). In here you can configure things like enabling the ability to direct boot the Linux kernel, where in dataflash the kernel and device tree is stored, where to copy them to in DRAM, and more. 20 | 21 | To start off, we need to get the default configuration (defconfig) that represents our board. Since our board is based on the SAM9N12EK board from Atmel, we have to find the name of that defconfig. In the root of the repository we can do the following: 22 | 23 | ```bash 24 | [hak8or@hak8or at91bootstrap_fiddle]$ find . -name "*sam9n12*defconfig" 25 | ./board/at91sam9n12ek/at91sam9n12eksd_linux_image_dt_defconfig 26 | ./board/at91sam9n12ek/at91sam9n12eksd_linux_image_defconfig 27 | ./board/at91sam9n12ek/at91sam9n12eknf_uboot_defconfig 28 | ./board/at91sam9n12ek/at91sam9n12eksd_uboot_defconfig 29 | ./board/at91sam9n12ek/at91sam9n12ekdf_linux_image_dt_defconfig 30 | ./board/at91sam9n12ek/at91sam9n12eknf_linux_image_defconfig 31 | ./board/at91sam9n12ek/at91sam9n12ekdf_linux_image_defconfig 32 | ./board/at91sam9n12ek/at91sam9n12eknf_linux_image_dt_defconfig 33 | ./board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig 34 | ``` 35 | 36 | The plan is to boot linux directly (so no uboot) and from dataflash instead of nandflash (so ```df``` instead of ```nf```). We will also be using a device tree (more on that later), in which case we also want the ```dt``` acronym. What's left is ```at91sam9n12ekdf_linux_image_dt_defconfig``` so running ```make at91sam9n12ekdf_linux_image_dt_defconfig``` will create a config file in the root of the git repo that is just a copy of that ```defconfig``` file which ```make menuconfig``` will modify. Since we just want the bootstrap to compile and run for now, we only need to make two changes via ```menuconfig```. First is in ```slow clock configuration options``` where you should uncheck ```Use External 32KHZ oscillator``` because this board does not have that component populated. 37 | 38 | Secondly is the DRAM configuration. The DRAM used in the evaluation kit is the ```MT47H64M16HR-3``` while we use the ```W9751G6KB-25```. Their IC has eight banks while ours has only 4, with the remaining timing paremeters being usable, so all we need to change is the following; 39 | 40 | ```c 41 | [hak8or@hak8or at91bootstrap]$ git diff board/at91sam9n12ek/at91sam9n12ek.c 42 | diff --git a/board/at91sam9n12ek/at91sam9n12ek.c b/board/at91sam9n12ek/at91sam9n12ek.c 43 | index fee32d5..369dab8 100644 44 | --- a/board/at91sam9n12ek/at91sam9n12ek.c 45 | +++ b/board/at91sam9n12ek/at91sam9n12ek.c 46 | @@ -74,7 +74,7 @@ static void ddramc_reg_config(struct ddramc_register *ddramc_config) 47 | ddramc_config->cr = (AT91C_DDRC2_NC_DDR10_SDR9 // 10 column bits (1K) 48 | | AT91C_DDRC2_NR_13 // 13 row bits (8K) 49 | | AT91C_DDRC2_CAS_3 // CAS Latency 3 50 | - | AT91C_DDRC2_NB_BANKS_8 // 8 banks 51 | + | AT91C_DDRC2_NB_BANKS_4 // 4 banks 52 | | AT91C_DDRC2_DISABLE_RESET_DLL 53 | | AT91C_DDRC2_DECOD_INTERLEAVED); 54 | ``` 55 | 56 | ## Toolchain 57 | 58 | This is where many run into issues, how to handle the toolchain. The way this guide is set up uses a fairly painless process on how to handle the toolchains for this project. This is also all done in an Arch Linux based distro for simplicities sake (Ubuntu PPA's tend to be so old that you have to manually add a PPA, Arch uses AUR which has a huge amount of packages which are actually up to date since it's a rolling release). There are two types of compilers we will use, ```arm-none-***``` 59 | and ```arm-linux-***```, the first of which being used for AT91 Bootstrap and SAM-BA applets while the second is for the Linux Kernel and cross compiling binaries running on the board under linux. 60 | 61 | In Arch, simply doing ```pacman -S arm-none-eabi-gcc``` will get you the newest (```7.3.0``` as of writing) toolchain, but under Ubuntu it seems doing ```apt get install arm-none-eabi-gcc``` should also suffice. For ```arm-linux***``` buildroot will be used (it fetches the toolchain and compiles everything for you, crazy stuff). 62 | 63 | ## Compiling 64 | Now that we have a compiler, we should be able to just run ```make CROSS_COMPILE=arm-none-eabi-``` successfully. 65 | 66 | ```bash 67 | [hak8or@hak8or at91bootstrap_fiddle]$ make CROSS_COMPILE=arm-none-eabi- 68 | CC 69 | ======== 70 | arm-none-eabi-gcc 7.3.0 71 | 72 | as FLAGS 73 | ======== 74 | -g -Os -Wall -I/home/hak8or/Desktop/armboard/at91bootstrap_fiddle/board/at91sam9n12ek -Iinclude -Icontrib/include -DJUMP_ADDR=0x22000000 -DTOP_OF_MEMORY=0x308000 -DMACH_TYPE=9999 -Dat91sam9n12ek -DMACH_TYPE=9999 -DTOP_OF_MEMORY=0x308000 -DCRYSTAL_16_000MHZ -DAT91SAM9N12 -mcpu=arm926ej-s -mtune=arm926ej-s -mfloat-abi=soft -DCONFIG_THUMB -mthumb-interwork -DCONFIG_AT91SAM9N12EK 75 | 76 | gcc FLAGS 77 | ========= 78 | -nostdinc -isystem /usr/lib/gcc/arm-none-eabi/7.3.0/include -ffunction-sections -g -Os -Wall -mno-unaligned-access -fno-stack-protector -fno-common -fno-builtin -I/home/hak8or/Desktop/armboard/at91bootstrap_fiddle/board/at91sam9n12ek -Icontrib/include -Iinclude -Ifs/include -I/home/hak8or/Desktop/armboard/at91bootstrap_fiddle/config/at91bootstrap-config -DAT91BOOTSTRAP_VERSION="3.8.10-rc1-dirty" -DCOMPILE_TIME="Tue Mar 27 02:26:14 EDT 2018" -DIMG_ADDRESS=0x00040000 -DIMG_SIZE= -DJUMP_ADDR=0x22000000 -DOF_OFFSET=0x00008400 -DOF_ADDRESS=0x21000000 -DMEM_BANK=0x20000000 -DMEM_SIZE=0x8000000 -DIMAGE_NAME="" -DCMDLINE="" -DCMDLINE_FILE="" -DTOP_OF_MEMORY=0x308000 -DMACH_TYPE=9999 -DCONFIG_DEBUG -DBANNER="\n\nAT91Bootstrap " AT91BOOTSTRAP_VERSION " (" COMPILE_TIME ")\n\n" -DCONFIG_HW_DISPLAY_BANNER -DCONFIG_HW_INIT -Dat91sam9n12ek -DMACH_TYPE=9999 -DTOP_OF_MEMORY=0x308000 -DCRYSTAL_16_000MHZ -DAT91SAM9N12 -mcpu=arm926ej-s -mtune=arm926ej-s -mfloat-abi=soft -DCONFIG_THUMB -mthumb -mthumb-interwork -DCONFIG_SCLK -DCONFIG_CRYSTAL_16_000MHZ -DCONFIG_CPU_CLK_400MHZ -DCONFIG_BUS_SPEED_133MHZ -DCPU_HAS_PIO3 -DCONFIG_AT91SAM9N12EK -DCONFIG_DDRC -DCONFIG_DDR2 -DCONFIG_RAM_64MB -DCONFIG_DATAFLASH -DCONFIG_LOAD_LINUX -DCONFIG_LINUX_IMAGE -DCONFIG_OF_LIBFDT -DCONFIG_DATAFLASH_RECOVERY -DCONFIG_SMALL_DATAFLASH -DAT91C_SPI_CLK=33000000 -DAT91C_SPI_PCS_DATAFLASH=AT91C_SPI_PCS0_DATAFLASH -DBOOTSTRAP_DEBUG_LEVEL=DEBUG_INFO -DCONFIG_DISABLE_WATCHDOG -DCPU_HAS_HSMCI0 -DCONFIG_SPI_BUS0 -DCONFIG_SPI 79 | 80 | ld FLAGS 81 | ======== 82 | -nostartfiles -Map=/home/hak8or/Desktop/armboard/at91bootstrap_fiddle/binaries/at91sam9n12ek-dataflashboot-linux--dt-3.8.10-rc1.map --cref -static -T elf32-littlearm.lds --gc-sections -Ttext 0x300000 83 | 84 | AS /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/crt0_gnu.S 85 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/main.c 86 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/board/at91sam9n12ek/at91sam9n12ek.c 87 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/lib/string.c 88 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/lib/eabi_utils.c 89 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/lib/div.c 90 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/lib/fdt.c 91 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/debug.c 92 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_slowclk.c 93 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/common.c 94 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_pio.c 95 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/pmc.c 96 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_pit.c 97 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_wdt.c 98 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_usart.c 99 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_rstc.c 100 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/ddramc.c 101 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/at91_spi.c 102 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/spi_flash.c 103 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/dataflash.c 104 | CC /home/hak8or/Desktop/armboard/at91bootstrap_fiddle/driver/load_kernel.c 105 | LD at91sam9n12ek-dataflashboot-linux--dt-3.8.10-rc1.elf 106 | Size of at91sam9n12ek-dataflashboot-linux--dt-3.8.10-rc1.bin is 8336 bytes 107 | [Succeeded] It's OK to fit into SRAM area 108 | [Attention] The space left for stack is 14664 bytes 109 | ``` 110 | 111 | ## Booting 112 | 113 | We need to copy the resulting ```boot.bin``` (which is a symlink to ```t91sam9n12ek-dataflashboot-linux--dt-3.8.10-rc1.bin```) to dataflash. Do **not** use just "copy file" because the ROM bootloader needs some extra information. Using the "Save Boot File" applet in SAM-BA will generate and save this extra information. 114 | 115 | ![AT91 Bootstrap Output](images/AT91Bootstrap_Flash.PNG) 116 | 117 | And when we restart the board then on the serial port we should be seeing the following; 118 | 119 | ```none 120 | RomBOOT 121 | 122 | 123 | 124 | AT91Bootstrap 3.8.10-rc1-dirty (Tue Mar 27 02:26:14 EDT 2018) 125 | 126 | SF: Got Manufacturer and Device ID: 0x1f 0x27 0x1 0x1 0x0 127 | SF: Press the recovery button (PB4) to recovery 128 | SF: Failed to load image 129 | ``` 130 | 131 | Looks like we have AT91 Bootstrap compiling, running, and interpreting the Dataflash IC correctly! [Next](devicetree.md) up is working with device tree. 132 | -------------------------------------------------------------------------------- /AT91SAM9N12/FinalThoughts.md: -------------------------------------------------------------------------------- 1 | # Final Thoughts 2 | 3 | The goal was to make an embedded Linux system from scratch. Originally it was planned to use the NAND Flash IC (```S34ML04G200TFI000``` at 512 MB) on the board, but sadly it doesn't work for some reason. Likely due to BGA soldering issues. Since that didn't work Dataflash was used instead, in which case it made this project more interesting on the software side due to having a size requirement. 4 | 5 | For storage, the root file system had to fit in under ```2.217 MB```, which when including all the packages above (except HTTP servers), we fit at ```2.148 MB```. So, in under 4 MB of flash we were able to fit in the kernel including drivers for our WiFi dongle, and a root file system with tons of networking things built in. A big reason why we were able to do this though is because the file system is both read only and using intense compression. When booting the system you can tell it takes a bit of time for the boot to finish at one point (~2 second hiccup). This is due to the slow 400 Mhz ARM926EJ based core having to load the root file system over a 33 Mhz SPI bus from Data Flash and then extract it. 6 | 7 | If you noticed, there are mentions of Brainy**V2** sprinkled around. As you can guess, this is the second version of my "Brainy" series of projects. The first one was my first every 4 layer PCB and first foray into BGA IC's and signals faster than those present in a 120 Mhz ARM MCU. 8 | 9 | ![BGA Pad size issues](images/BGA_Pad_Issue.jpg) 10 | 11 | It was a total disaster in terms of assembly (footprint for the BGA IC was way too small) and expensive to reproduce (~$20 worth of components for a ~25 PCB and many hours of assembly). Modularity was king at this point, so if a design has to be redone it only needs the most likely part to fail (main logic board with SOC + DRAM) to be discarded, saving money and time. 12 | 13 | OSH Park (the fab I use) can at best do 4 layer PCB's with BGA pitch of 0.8 MM due to the trace width and space being at minimum 5 mil. If the BGA pitch is less than 0.8 MM then you cannot put traces between the pads on the PCB, and therefore being unable to fanout traces more than 1 layer deep. Thankfully there are still many BGA IC's out there that have a ball pitch of 0.8 mm. 14 | 15 | All in all, this was a great project. This totally satisfied my need of making a Linux system from scratch and learning lots on the way. My one gripe is how much of a pain it is to assemble these chips, it's easily half a day of work to put one board together, and the likely hood of failure during assembly is high. 16 | 17 | ## Brainy V3 and onwards 18 | 19 | Even though assembly of these boards is a pain, and I am not willing to pay a few hundred to outsource assembly on a potentially bad design, I want to make more. Brainy V3 is composed of two designs, each using a more modern SOC, one from Allwinner (V3s) and the other from Freescale (SoloLite). The V3s design has an SDIO based WiFi solution embedded into the PCB too! The PCB design is complete but has to be fixed (pads for BGA were too small again, silk is bad in areas, etc) before assembly and testing is done. 20 | 21 | ![Brainy V3 Front](images/BrainyV3_Front.jpg) 22 | 23 | ![Brainy V3 Back](images/BrainyV3_Back.jpg) 24 | 25 | For Brainy V4, I will likely use a PCB fab which can handle BGA ball pitches of 0.65 MM, which gives me access to much more modern SOC's like the [RK3399](http://opensource.rock-chips.com/wiki_RK3399). This beast has two 64 bit A72 cores running at 1.8 Ghz and 4 A53 cores running at 1.4 Ghz, Display Port, HDMI, 2x 4 Lane MIPI DSI, PCI-E 4x Lane, and can handle a 64 bit memory interface to LPDDR4 RAM. It's accessible via Taobao and it's documentation is online, including various designs which can be used as reference. 26 | 27 | ![Cheap RK3399](images/RK3399_Taobao.PNG) 28 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/at91-bootstrap/.config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated make config: don't edit 3 | # Sat Feb 28 23:31:08 2015 4 | # 5 | HAVE_DOT_CONFIG=y 6 | # CONFIG_AT91SAM9260EK is not set 7 | # CONFIG_AT91SAM9261EK is not set 8 | # CONFIG_AT91SAM9263EK is not set 9 | # CONFIG_AT91SAM9RLEK is not set 10 | # CONFIG_AT91SAM9XEEK is not set 11 | # CONFIG_AT91SAM9G10EK is not set 12 | # CONFIG_AT91SAM9G20EK is not set 13 | # CONFIG_AT91SAM9M10G45EK is not set 14 | # CONFIG_AT91SAM9X5EK is not set 15 | CONFIG_AT91SAM9N12EK=y 16 | # CONFIG_SAMA5D3XEK is not set 17 | # CONFIG_SAMA5D3_XPLAINED is not set 18 | # CONFIG_SAMA5D3X_CMP is not set 19 | # CONFIG_SAMA5D4EK is not set 20 | # CONFIG_SAMA5D4_XPLAINED is not set 21 | CONFIG_BOARDNAME="at91sam9n12ek" 22 | AT91SAM9N12=y 23 | CONFIG_MACH_TYPE="9999" 24 | CONFIG_LINK_ADDR="0x300000" 25 | CONFIG_TOP_OF_MEMORY="0x308000" 26 | CONFIG_CRYSTAL_12_000MHZ=y 27 | # CONFIG_CRYSTAL_16_000MHZ is not set 28 | # CONFIG_CRYSTAL_16_36766MHZ is not set 29 | # CONFIG_CRYSTAL_18_432MHZ is not set 30 | ALLOW_CRYSTAL_12_000MHZ=y 31 | CONFIG_CRYSTAL="CRYSTAL_12_000MHZ" 32 | # CONFIG_CPU_CLK_166MHZ is not set 33 | # CONFIG_CPU_CLK_180MHZ is not set 34 | # CONFIG_CPU_CLK_200MHZ is not set 35 | # CONFIG_CPU_CLK_240MHZ is not set 36 | # CONFIG_CPU_CLK_266MHZ is not set 37 | # CONFIG_CPU_CLK_332MHZ is not set 38 | # CONFIG_CPU_CLK_396MHZ is not set 39 | CONFIG_CPU_CLK_400MHZ=y 40 | # CONFIG_CPU_CLK_444MHZ is not set 41 | # CONFIG_CPU_CLK_498MHZ is not set 42 | # CONFIG_CPU_CLK_510MHZ is not set 43 | # CONFIG_CPU_CLK_528MHZ is not set 44 | ALLOW_CPU_CLK_400MHZ=y 45 | # DISABLE_CPU_CLK_240MHZ is not set 46 | # CONFIG_BUS_SPEED_83MHZ is not set 47 | # CONFIG_BUS_SPEED_90MHZ is not set 48 | # CONFIG_BUS_SPEED_100MHZ is not set 49 | CONFIG_BUS_SPEED_133MHZ=y 50 | # CONFIG_BUS_SPEED_148MHZ is not set 51 | # CONFIG_BUS_SPEED_166MHZ is not set 52 | # CONFIG_BUS_SPEED_170MHZ is not set 53 | # CONFIG_BUS_SPEED_176MHZ is not set 54 | SUPPORT_BUS_SPEED_133MHZ=y 55 | # CONFIG_TRUSTZONE is not set 56 | # CONFIG_CPU_V7 is not set 57 | # CONFIG_HAS_PMIC_ACT8865 is not set 58 | # CONFIG_SUPPORT_PM is not set 59 | # CONFIG_HAS_ONE_WIRE is not set 60 | # CONFIG_HAS_EEPROM is not set 61 | # CONFIG_HAS_EHT0_PHY is not set 62 | # CONFIG_HAS_EHT1_PHY is not set 63 | # CONFIG_HAS_AUDIO_CODEC is not set 64 | # CONFIG_HAS_HDMI is not set 65 | ALLOW_PIO3=y 66 | CONFIG_HAS_PIO3=y 67 | CPU_HAS_PMECC=y 68 | # CONFIG_HAS_HW_INFO is not set 69 | # CONFIG_MMC_SUPPORT is not set 70 | # CONFIG_TWI is not set 71 | # CONFIG_TWI0 is not set 72 | # CONFIG_TWI1 is not set 73 | # CONFIG_TWI2 is not set 74 | # CONFIG_TWI3 is not set 75 | # CONFIG_MACB is not set 76 | # CONFIG_AES is not set 77 | # CONFIG_LOAD_HW_INFO is not set 78 | CPU_HAS_TWI0=y 79 | CPU_HAS_TWI1=y 80 | # CPU_HAS_TWI2 is not set 81 | # CPU_HAS_TWI3 is not set 82 | # CPU_HAS_AES is not set 83 | 84 | # 85 | # Memory selection 86 | # 87 | # CONFIG_SDRAM is not set 88 | # CONFIG_SDDRC is not set 89 | CONFIG_DDRC=y 90 | ALLOW_DATAFLASH=y 91 | # ALLOW_FLASH is not set 92 | ALLOW_NANDFLASH=y 93 | ALLOW_SDCARD=y 94 | ALLOW_HSMCI=y 95 | # ALLOW_PSRAM is not set 96 | # ALLOW_SDRAM_16BIT is not set 97 | 98 | # 99 | # RAM Configuration 100 | # 101 | # CONFIG_RAM_32MB is not set 102 | CONFIG_RAM_64MB=y 103 | # CONFIG_RAM_128MB is not set 104 | # CONFIG_RAM_256MB is not set 105 | # CONFIG_RAM_512MB is not set 106 | # CONFIG_LPDDR2 is not set 107 | CONFIG_DDR2=y 108 | CONFIG_DATAFLASH=y 109 | # CONFIG_FLASH is not set 110 | # CONFIG_NANDFLASH is not set 111 | # CONFIG_SDCARD is not set 112 | CONFIG_MEMORY="dataflash" 113 | 114 | # 115 | # SPI configuration 116 | # 117 | CONFIG_SPI_CLK=660000 118 | CONFIG_SMALL_DATAFLASH=y 119 | # CONFIG_DATAFLASH_RECOVERY is not set 120 | ALLOW_DATAFLASH_RECOVERY=y 121 | CONFIG_SPI_BOOT_CS0=y 122 | # CONFIG_SPI_BOOT_CS1 is not set 123 | # CONFIG_SPI_BOOT_CS2 is not set 124 | # CONFIG_SPI_BOOT_CS3 is not set 125 | ALLOW_BOOT_FROM_DATAFLASH_CS0=y 126 | # ALLOW_BOOT_FROM_DATAFLASH_CS1 is not set 127 | # ALLOW_BOOT_FROM_DATAFLASH_CS2 is not set 128 | # ALLOW_BOOT_FROM_DATAFLASH_CS3 is not set 129 | # DATAFLASHCARD_ON_CS0 is not set 130 | # DATAFLASHCARD_ON_CS1 is not set 131 | # DATAFLASHCARD_ON_CS2 is not set 132 | # DATAFLASHCARD_ON_CS3 is not set 133 | # CONFIG_DATAFLASHCARD is not set 134 | CONFIG_CARD_SUFFIX="" 135 | CONFIG_SPI_BOOT="AT91C_SPI_PCS0_DATAFLASH" 136 | ALLOW_NANDFLASH_RECOVERY=y 137 | CONFIG_BOOTSTRAP_MAXSIZE="23000" 138 | CONFIG_PROJECT="dataflash" 139 | CONFIG_LOAD_UBOOT=y 140 | # CONFIG_LOAD_LINUX is not set 141 | # CONFIG_LOAD_ANDROID is not set 142 | # CONFIG_LOAD_1MB is not set 143 | # CONFIG_LOAD_4MB is not set 144 | # CONFIG_LOAD_64KB is not set 145 | CONFIG_IMG_ADDRESS="0x8400" 146 | CONFIG_JUMP_ADDR="0x20008400" 147 | 148 | # 149 | # U-Boot Image Storage Setup 150 | # 151 | CONFIG_IMG_SIZE="0x55500" 152 | CONFIG_IMAGE_NAME="u-boot.bin" 153 | CONFIG_DEBUG=y 154 | # CONFIG_DEBUG_INFO is not set 155 | # CONFIG_DEBUG_LOUD is not set 156 | CONFIG_DEBUG_VERY_LOUD=y 157 | # CONFIG_THUMB is not set 158 | CONFIG_DISABLE_WATCHDOG=y 159 | 160 | # 161 | # Hardware Initialization Options 162 | # 163 | CONFIG_HW_INIT=y 164 | # CONFIG_USER_HW_INIT is not set 165 | 166 | # 167 | # Slow Clock Configuration Options 168 | # 169 | # CONFIG_SCLK is not set 170 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/at91-bootstrap/0001-Changed-128MB-to-64MB-of-DRAM.patch: -------------------------------------------------------------------------------- 1 | From 7f54d50161dbdf8d9d5d6cdb94ed9da379c63836 Mon Sep 17 00:00:00 2001 2 | From: hak8or 3 | Date: Fri, 27 Mar 2015 02:04:32 -0400 4 | Subject: [PATCH 1/5] Changed 128MB to 64MB of DRAM. 5 | 6 | --- 7 | board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig b/board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig 11 | index 5a0a14e..79fdf40 100644 12 | --- a/board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig 13 | +++ b/board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig 14 | @@ -1,5 +1,5 @@ 15 | CONFIG_AT91SAM9N12EK=y 16 | -CONFIG_RAM_128MB=y 17 | +CONFIG_RAM_64MB=y 18 | CONFIG_DEBUG=y 19 | CONFIG_THUMB=y 20 | CONFIG_SCLK=y 21 | -- 22 | 2.1.0 23 | 24 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/at91-bootstrap/0002-Dropped-DRAM-MCLK-from-133-Mhz-to-100-Mhz.patch: -------------------------------------------------------------------------------- 1 | From f95b39a4876b10ce5576c0b60bbf04dcae53f428 Mon Sep 17 00:00:00 2001 2 | From: hak8or 3 | Date: Fri, 27 Mar 2015 02:14:27 -0400 4 | Subject: [PATCH 2/5] Dropped DRAM + MCLK from 133 Mhz to 100 Mhz 5 | 6 | --- 7 | board/at91sam9n12ek/at91sam9n12ek.h | 6 +++--- 8 | 1 file changed, 3 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/board/at91sam9n12ek/at91sam9n12ek.h b/board/at91sam9n12ek/at91sam9n12ek.h 11 | index e39a820..dece3b5 100644 12 | --- a/board/at91sam9n12ek/at91sam9n12ek.h 13 | +++ b/board/at91sam9n12ek/at91sam9n12ek.h 14 | @@ -35,16 +35,16 @@ 15 | * and MCK is switched on the main oscillator. 16 | * PLL initialization is done later in the hw_init() function 17 | */ 18 | -#define MASTER_CLOCK (132096000) 19 | +#define MASTER_CLOCK (100000000) 20 | #define PLL_LOCK_TIMEOUT 10000 21 | 22 | #define BOARD_MAINOSC 16000000 23 | -#define BOARD_MCK 133000000 24 | +#define BOARD_MCK 100000000 25 | #define BOARD_OSCOUNT (AT91C_CKGR_OSCOUNT & (64 << 8)) 26 | #define BOARD_CKGR_PLLA (AT91C_CKGR_SRCA | AT91C_CKGR_OUTA_0) 27 | #define BOARD_PLLACOUNT (0x3F << 8) 28 | //#define BOARD_MULA (AT91C_CKGR_MULA & (199 << 16)) 29 | -#define BOARD_MULA (AT91C_CKGR_MULA & (149 << 16)) 30 | +#define BOARD_MULA (AT91C_CKGR_MULA & (112 << 16)) 31 | #define BOARD_DIVA (AT91C_CKGR_DIVA & 3) 32 | 33 | #define BOARD_PRESCALER_MAIN_CLOCK (AT91C_PMC_PLLADIV2_2 \ 34 | -- 35 | 2.1.0 36 | 37 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/at91-bootstrap/0003-Relaxed-DRAM-timings-and-changed-8-to-4-banks.patch: -------------------------------------------------------------------------------- 1 | From 7627b9b3adfd97ea31cb1e8ea75907a43bc6b088 Mon Sep 17 00:00:00 2001 2 | From: hak8or 3 | Date: Fri, 27 Mar 2015 02:15:31 -0400 4 | Subject: [PATCH 3/5] Relaxed DRAM timings and changed 8 to 4 banks 5 | 6 | --- 7 | board/at91sam9n12ek/at91sam9n12ek.c | 24 +++++++++++++----------- 8 | 1 file changed, 13 insertions(+), 11 deletions(-) 9 | 10 | diff --git a/board/at91sam9n12ek/at91sam9n12ek.c b/board/at91sam9n12ek/at91sam9n12ek.c 11 | index 1c9bd86..14f071e 100644 12 | --- a/board/at91sam9n12ek/at91sam9n12ek.c 13 | +++ b/board/at91sam9n12ek/at91sam9n12ek.c 14 | @@ -79,7 +79,7 @@ static void ddramc_reg_config(struct ddramc_register *ddramc_config) 15 | ddramc_config->cr = (AT91C_DDRC2_NC_DDR10_SDR9 // 10 column bits (1K) 16 | | AT91C_DDRC2_NR_13 // 13 row bits (8K) 17 | | AT91C_DDRC2_CAS_3 // CAS Latency 3 18 | - | AT91C_DDRC2_NB_BANKS_8 // 8 banks 19 | + | AT91C_DDRC2_NB_BANKS_4 // 4 banks 20 | | AT91C_DDRC2_DLL_RESET_DISABLED // DLL not reset 21 | | AT91C_DDRC2_DECOD_INTERLEAVED); // Interleaved decoding 22 | 23 | @@ -88,28 +88,30 @@ static void ddramc_reg_config(struct ddramc_register *ddramc_config) 24 | * With a 133 MHz frequency, the refresh timer count register must to be 25 | * set with (15.625 x 133 MHz) ~ 2084 i.e. 0x824 26 | * or (7.81 x 133 MHz) ~ 1040 i.e. 0x410. 27 | + * 28 | + * This was changed to have a clock of 100 Mhz by hak8or, ignore above. 29 | */ 30 | - ddramc_config->rtr = 0x411; /* Refresh timer: 7.8125us */ 31 | + ddramc_config->rtr = 0x30D; /* Refresh timer: 7.8125us */ 32 | 33 | - /* One clock cycle @ 133 MHz = 7.5 ns */ 34 | - ddramc_config->t0pr = (AT91C_DDRC2_TRAS_(6) 35 | + /* One clock cycle @ 100 MHz = 10 ns */ 36 | + ddramc_config->t0pr = (AT91C_DDRC2_TRAS_(5) 37 | | AT91C_DDRC2_TRCD_(2) 38 | | AT91C_DDRC2_TWR_(2) 39 | - | AT91C_DDRC2_TRC_(8) 40 | + | AT91C_DDRC2_TRC_(6) 41 | | AT91C_DDRC2_TRP_(2) 42 | - | AT91C_DDRC2_TRRD_(2) 43 | + | AT91C_DDRC2_TRRD_(1) 44 | | AT91C_DDRC2_TWTR_(2) 45 | | AT91C_DDRC2_TMRD_(2)); 46 | 47 | ddramc_config->t1pr = (AT91C_DDRC2_TXP_(2) 48 | | AT91C_DDRC2_TXSRD_(200) 49 | - | AT91C_DDRC2_TXSNR_(19) 50 | - | AT91C_DDRC2_TRFC_(18)); 51 | + | AT91C_DDRC2_TXSNR_(12) 52 | + | AT91C_DDRC2_TRFC_(11)); 53 | 54 | ddramc_config->t2pr = (AT91C_DDRC2_TRTP_(2) 55 | - | AT91C_DDRC2_TRPA_(3) 56 | - | AT91C_DDRC2_TXARDS_(7) 57 | - | AT91C_DDRC2_TXARD_(2)); 58 | + | AT91C_DDRC2_TRPA_(2) 59 | + | AT91C_DDRC2_TXARDS_(8) 60 | + | AT91C_DDRC2_TXARD_(3)); 61 | } 62 | 63 | static void ddramc_init(void) 64 | -- 65 | 2.1.0 66 | 67 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/at91-bootstrap/0004-Added-debug-prompts-to-SPI-init-MCLK-SPI-speed-etc.patch: -------------------------------------------------------------------------------- 1 | From 75001ff2ba862f50bda168e33e6c753121751d40 Mon Sep 17 00:00:00 2001 2 | From: hak8or 3 | Date: Fri, 27 Mar 2015 02:17:02 -0400 4 | Subject: [PATCH 4/5] Added debug prompts to SPI init (MCLK, SPI speed, etc). 5 | 6 | --- 7 | driver/at91_spi.c | 6 ++++++ 8 | 1 file changed, 6 insertions(+) 9 | 10 | diff --git a/driver/at91_spi.c b/driver/at91_spi.c 11 | index 3ecb128..95d5ac4 100644 12 | --- a/driver/at91_spi.c 13 | +++ b/driver/at91_spi.c 14 | @@ -97,7 +97,13 @@ int at91_spi_init(unsigned int pcs, unsigned int clock, unsigned int mode) 15 | if (!clock) 16 | return -1; 17 | 18 | + dbg_info("MASTER_CLOCK (MCLK): %d \n", MASTER_CLOCK); 19 | + dbg_info("SPI clock rate requested: %d \n", clock); 20 | + 21 | scbr = div(MASTER_CLOCK, clock); 22 | + 23 | + dbg_info("scbr: %d \n", scbr); 24 | + 25 | reg = AT91C_SPI_SCBR(scbr); 26 | reg |= AT91C_SPI_BITS_8; 27 | 28 | -- 29 | 2.1.0 30 | 31 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/at91-bootstrap/readme.md: -------------------------------------------------------------------------------- 1 | ### Getting started 2 | Config file already included, so just running applying the patches and then running ```make arch=ARM CROSS_COMPILE="put crosscompiler path here"``` should suffice. 3 | 4 | Using SAM-BA, dump this to dataflash using the burn bootloader option. **DO NOT** use the save file option, since the burn bootloader option fills in the needed bootloader file length during saving to dataflash used for determinig how much data off dataflash needs to be copied into internal SRAM by the NVM bootloader. 5 | 6 | ### Targets for config 7 | - ```at91sam9n12ekdf_linux_zimage_dt_defconfig``` 8 | - ```at91sam9n12ekdf_linux_uimage_dt_defconfig``` 9 | - ```at91sam9n12ekdf_linux_zimage_defconfig``` 10 | - ```at91sam9n12ekdf_linux_uimage_defconfig``` 11 | - ```at91sam9n12ekdf_uboot_defconfig``` <-- Use this if not using config file. 12 | 13 | ### Dependancies 14 | - **Cross-Compiler:** Generate using Crosstools-NG (reccomended since you will have to make a cross-compiler eventually) or download from ARM's launchpad [here](https://launchpad.net/gcc-arm-embedded). 15 | 16 | - **AT91bootstrap:** The source can be gotten using ```git clone git://github.com/linux4sam/at91bootstrap.git``` but if the you need the old version which is guaranteed to work with this chip, you can get it off the Linux4sam website using the [LegacySAM9N12](http://www.at91.com/linux4sam/bin/view/Linux4SAM/LegacySAM9N12Page) page, prepackged in a [tar archive](ftp://ftp.linux4sam.org/pub/at91bootstrap/AT91Bootstrap3.2/at91bootstrap_9n12.tar.gz). Note, extract the arhive like a pro by doing ```tar xf t91bootstrap_9n12.tar.gz``` which auto determines the archive type. 17 | 18 | ### Changes outline 19 | - **Memory** 20 | - **64MB vs 128MB:** The at91sam9n12ek (at91sam9n12 Eval Kit) is designed with 128 MB DRAM, but we are only using 64 MB, which is reflected in ```board/at91sam9n12ek/at91sam9n12ekdf_uboot_defconfig```. 21 | - **4 vs 8 Banks + timings:** My memory is also from another company which means diffirent timings, as well as due to the smaller size less banks (4 vs 8), both of which are reflected in ```board/at91sam9n12ek/at91sam9n12ek.c```. 22 | - **100 Mhz vs 133 Mhz:** The memory clock which is baisically the main system bus clock was dropped from 133 Mhz to 100 Mhz. I didn't get a chance to really test this, just added it while changing the timings due to potential signal integrity issues, so chances are it's not needed. This is reflected in ```board/at91sam9n12ek/at91sam9n12ek.h```. Note, this also drops the core clock from ~400 Mhz to ~300 Mhz. 23 | - **SPI debug** 24 | - **Debug prompts:** Added debug serial prompts saying the current master clock, requested SPI clock, and the current scbr register state. This is reflected in ```driver/at91_spi.c```. 25 | - **Main program** 26 | - **Memory tests:** Added memory tests such as alternating patterns, specific patterns, verifying arm exception vectors, and detecting (un)filled memory. These are not all functional tests as of commiting, and will be cleaned up eventually. Reflected in ```main.c``` 27 | - **Debug prompts:** Added debug prompts to indicate bootloader progress. Reflected in ```main.c``` 28 | 29 | The above changes are in the patch files, apply them sequentially using ```git apply patch-file.patch```. -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/busybox/readme.md: -------------------------------------------------------------------------------- 1 | ### Getting started 2 | Config file already included, so just running applying the patches and then running ```make arch=ARM CROSS_COMPILE="put crosscompiler path here"``` should suffice. You can do make ```make menuconfig``` to select if you want it to be statically or dynamically linked. If dynamically linked, you need to add the approriate librares from your cross compilers ```sysroot/lib``` directory. 3 | 4 | Busybox makes it's own inittab if one isn't provided, but it assumes that there are more serial ports than there really are, causing it to spam the serial port with ```/dev/ttyS# missing``` messeges every ~1/4 of a second. Supplying your own like this will prevent that. 5 | ``` 6 | touch rootfs/etc/inittab 7 | cat <<'EOF' >> rootfs/etc/inittab 8 | ::sysinit:/etc/init.d/rcS 9 | ::respawn:/bin/sh 10 | ::ctrlaltdel:/sbin/reboot 11 | ::shutdown:/sbin/swapoff -a 12 | ::shutdown:/bin/umount -a -r 13 | ::restart:/sbin/init 14 | EOF 15 | ``` 16 | Check the [root_file_sys directory](root_file_sys/) for more detail and a script which does this for you. Also, [this](https://gist.github.com/eepp/6056325) amazing gist shows how to handle a rootfs with busybox, and while it's for the beaglebone the process is nearly indentical for sam9n12 after the kernel steps. 17 | 18 | If using a staticly compile busybox then there are no needed shared libraries to copy. 19 | - **Simple:** Just putting the executable in the rootfs at /bin and calling busybox *command* 20 | - **Correct:** Run ```make install``` which makes a _install dir containing approriate symlinks, allowing you to run commands normally. 21 | 22 | ### Dependancies 23 | - **Cross-Compiler:** Generate using Crosstools-NG (reccomended since you will have to make a cross-compiler eventually) or download from ARM's launchpad [here](https://launchpad.net/gcc-arm-embedded). 24 | 25 | - **Busybox:** You can get the official most recent source from the official repo like so ```git clone git://busybox.net/busybox.git```. No modifications are needed. 26 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/Crosstools-NG-output.txt: -------------------------------------------------------------------------------- 1 | hak8or@ubuntu:~/Desktop/toolchain_setup/crosstool-ng-crosstool-ng-1.20.0$ ./ct-ng build 2 | [INFO ] Performing some trivial sanity checks 3 | [INFO ] Build started 20150322.140851 4 | [INFO ] Building environment variables 5 | [INFO ] ================================================================= 6 | [INFO ] Retrieving needed toolchain components' tarballs 7 | [INFO ] Retrieving needed toolchain components' tarballs: done in 90.31s (at 01:43) 8 | [INFO ] ================================================================= 9 | [INFO ] Extracting and patching toolchain components 10 | [INFO ] Extracting and patching toolchain components: done in 54.14s (at 02:37) 11 | [INFO ] ================================================================= 12 | [INFO ] Installing GMP for host 13 | [INFO ] Installing GMP for host: done in 43.05s (at 03:20) 14 | [INFO ] ================================================================= 15 | [INFO ] Installing MPFR for host 16 | [INFO ] Installing MPFR for host: done in 15.81s (at 03:36) 17 | [INFO ] ================================================================= 18 | [INFO ] Installing ISL for host 19 | [INFO ] Installing ISL for host: done in 24.46s (at 04:00) 20 | [INFO ] ================================================================= 21 | [INFO ] Installing CLooG for host 22 | [INFO ] Installing CLooG for host: done in 6.35s (at 04:07) 23 | [INFO ] ================================================================= 24 | [INFO ] Installing MPC for host 25 | [INFO ] Installing MPC for host: done in 6.18s (at 04:13) 26 | [INFO ] ================================================================= 27 | [INFO ] Installing binutils for host 28 | [INFO ] Installing binutils for host: done in 50.75s (at 05:04) 29 | [INFO ] ================================================================= 30 | [INFO ] Installing pass-1 core C compiler 31 | [INFO ] Installing pass-1 core C compiler: done in 218.88s (at 08:43) 32 | [INFO ] ================================================================= 33 | [INFO ] Installing kernel headers 34 | [INFO ] Installing kernel headers: done in 8.28s (at 08:51) 35 | [INFO ] ================================================================= 36 | [INFO ] Installing C library headers & start files 37 | [INFO ] Installing C library headers & start files: done in 13.10s (at 09:04) 38 | [INFO ] ================================================================= 39 | [INFO ] Installing pass-2 core C compiler 40 | [INFO ] Installing pass-2 core C compiler: done in 307.88s (at 14:12) 41 | [INFO ] ================================================================= 42 | [INFO ] Installing C library 43 | [INFO ] Installing C library: done in 248.27s (at 18:20) 44 | [INFO ] ================================================================= 45 | [INFO ] Installing final compiler 46 | [INFO ] Installing final compiler: done in 527.87s (at 27:08) 47 | [INFO ] ================================================================= 48 | [INFO ] Cleaning-up the toolchain's directory 49 | [INFO ] Stripping all toolchain executables 50 | [INFO ] Cleaning-up the toolchain's directory: done in 7.38s (at 27:15) 51 | [INFO ] Build completed at 20150322.143607 52 | [INFO ] (elapsed: 27:15.29) 53 | [INFO ] Finishing installation (may take a few seconds)... 54 | [27:16] / hak8or@ubuntu:~/Desktop/toolchain_setup/crosstool-ng-crosstool-ng-1.20.0$ -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/USB-working-in-U-Boot.txt: -------------------------------------------------------------------------------- 1 | Contents at 0x2005d8f8 : 0xffffffff 2 | Contents at 0x2005d8fc : 0xffffffff 3 | Jumping to JUMP_ADDR (0x20008400) ... 4 | 5 | 6 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 15 2015 - 01:53:35) 7 | 8 | CPU: AT91SAM9N12 9 | Crystal frequency: 16 MHz 10 | CPU clock : 301.333 MHz 11 | Master clock : 100.444 MHz 12 | DRAM: 64 MiB 13 | WARNING: Caches not enabled 14 | NAND: atmel_nand: Fail to initialize #0 chip0 MiB 15 | MMC: mci: 0 16 | SF: Detected AT45DB081D with page size 256 Bytes, erase size 4 KiB, total 1 MiB 17 | *** Warning - bad CRC, using default environment 18 | 19 | In: serial 20 | Out: serial 21 | Err: serial 22 | Net: ks8851_mll: Invalid chip id 0x30c0 23 | Board Net Initialization Failed 24 | No ethernet found. 25 | Hit any key to stop autoboot: 0 26 | SF: Detected AT45DB081D with page size 256 Bytes, erase size 4 KiB, total 1 MiB 27 | ERROR: attempting read past flash size (0x100000) 28 | Wrong Image Format for bootm command 29 | ERROR: can't get kernel image! 30 | U-Boot> ls 31 | Unknown command 'ls' - try 'help' 32 | U-Boot> usb start 33 | (Re)start USB... 34 | USB0: scanning bus 0 for devices... 1 USB Device(s) found 35 | scanning usb for storage devices... 0 Storage Device(s) found 36 | U-Boot> usb start 37 | (Re)start USB... 38 | USB0: scanning bus 0 for devices... 2 USB Device(s) found 39 | scanning usb for storage devices... 1 Storage Device(s) found 40 | U-Boot> usb info 41 | 1: Hub, USB Revision 1.10 42 | - U-Boot Root Hub 43 | - Class: Hub 44 | - PacketSize: 8 Configurations: 1 45 | - Vendor: 0x0000 Product 0x0000 Version 0.0 46 | Configuration: 1 47 | - Interfaces: 1 Self Powered 0mA 48 | Interface: 0 49 | - Alternate Setting 0, Endpoints: 1 50 | - Class Hub 51 | - Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms 52 | 53 | 2: Mass Storage, USB Revision 2.0 54 | - OCZ DIESEL 50E69116000688 55 | - Class: (from Interface) Mass Storage 56 | - PacketSize: 64 Configurations: 1 57 | - Vendor: 0x13fe Product 0x1f00 Version 1.16 58 | Configuration: 1 59 | - Interfaces: 1 Bus Powered 100mA 60 | Interface: 0 61 | - Alternate Setting 0, Endpoints: 2 62 | - Class Mass Storage, Transp. SCSI, Bulk only 63 | - Endpoint 1 In Bulk MaxPacket 64 64 | - Endpoint 2 Out Bulk MaxPacket 64 65 | 66 | U-Boot> ubifs 67 | Unknown command 'ubifs' - try 'help' 68 | U-Boot> usb storage 69 | Device 0: Vendor: OCZ Rev: PMAP Prod: DIESEL 70 | Type: Removable Hard Disk 71 | Capacity: 15296.0 MB = 14.9 GB (31326208 x 512) 72 | U-Boot> usb part 73 | 74 | Partition Map for USB device 0 -- Partition Type: DOS 75 | 76 | Part Start Sector Num Sectors UUID Type 77 | 1 1 31326206 00006cbc-01 07 Boot 78 | U-Boot> usb tree 79 | USB device tree: 80 | 1 Hub (12 Mb/s, 0mA) 81 | | U-Boot Root Hub 82 | | 83 | +-2 Mass Storage (12 Mb/s, 100mA) 84 | OCZ DIESEL 50E69116000688 85 | 86 | U-Boot> 87 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/Verifying Busybox execution.txt: -------------------------------------------------------------------------------- 1 | RomBOOT 2 | 3 | 4 | 5 | 6 | ============================== 7 | Using Dataflash! 8 | ba_offset = 0xb ... 9 | AT91Bootstrap 3.7.1-00054-gef803bb-dirty (Sun Mar 15 19:00:41 PDT 2015) 10 | Edited by hak8or! 11 | Yey custom code execution and toolchain verification! :D 12 | ======--======--======--====== 13 | MASTER_CLOCK (MCLK): 0x5f5e100 14 | SPI clock rate requested: 0xa1220 15 | scbr: 0x97 16 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 17 | SF: Copy 0x55500 bytes from 0x8400 to 0x20008400 18 | SF: Done loading image from SerialFlash 19 | Jumping to JUMP_ADDR (0x20008400) ... 20 | 21 | 22 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 16 2015 - 07:19:40) 23 | 24 | CPU: AT91SAM9N12 25 | Crystal frequency: 16 MHz 26 | CPU clock : 301.333 MHz 27 | Master clock : 100.444 MHz 28 | DRAM: 64 MiB 29 | WARNING: Caches not enabled 30 | NAND: atmel_nand: Fail to initialize #0 chip0 MiB 31 | MMC: mci: 0 32 | ** Bad device usb 0 ** 33 | Using default environment 34 | 35 | In: serial 36 | Out: serial 37 | Err: serial 38 | Net: ks8851_mll: Invalid chip id 0x30c0 39 | Board Net Initialization Failed 40 | No ethernet found. 41 | Hit any key to stop autoboot: 0 42 | U-Boot> usb start 43 | (Re)start USB... 44 | USB0: scanning bus 0 for devices... 2 USB Device(s) found 45 | scanning usb for storage devices... 1 Storage Device(s) found 46 | U-Boot> fatload usb 0:1 0x20000000 uimage.bin; bootm; 47 | reading uimage.bin 48 | 1515300 bytes read in 4077 ms (362.3 KiB/s) 49 | ## Booting kernel from Legacy Image at 20000000 ... 50 | Image Name: linux-2.6 51 | Image Type: ARM Linux Kernel Image (uncompressed) 52 | Data Size: 1515236 Bytes = 1.4 MiB 53 | Load Address: 20008000 54 | Entry Point: 20008000 55 | Verifying Checksum ... OK 56 | Loading Kernel Image ... OK 57 | 58 | Starting kernel ... 59 | 60 | Uncompressing Linux... done, booting the kernel. 61 | Linux version 2.6.39 (hak8or@ubuntu) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #5 Mon Mar 16 07:24:35 EDT 2015 62 | CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 63 | CPU: VIVT data cache, VIVT instruction cache 64 | Machine: Atmel AT91SAM9N12-EK 65 | Memory policy: ECC disabled, Data cache writeback 66 | Clocks: CPU 301 MHz, master 100 MHz, main 16.000 MHz 67 | Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 68 | Kernel command line: console=ttyS0,115200 root=/dev/sda2 rootwait ro rootfstype=ext2 init=/bin/init 69 | PID hash table entries: 256 (order: -2, 1024 bytes) 70 | Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 71 | Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 72 | Memory: 64MB = 64MB total 73 | Memory: 61728k/61728k available, 3808k reserved, 0K highmem 74 | Virtual kernel memory layout: 75 | vector : 0xffff0000 - 0xffff1000 ( 4 kB) 76 | fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) 77 | DMA : 0xff000000 - 0xffe00000 ( 14 MB) 78 | vmalloc : 0xc4800000 - 0xfee00000 ( 934 MB) 79 | lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) 80 | modules : 0xbf000000 - 0xc0000000 ( 16 MB) 81 | .init : 0xc0008000 - 0xc0027000 ( 124 kB) 82 | .text : 0xc0027000 - 0xc02de000 (2780 kB) 83 | .data : 0xc02de000 - 0xc02fcac0 ( 123 kB) 84 | NR_IRQS:192 85 | AT91: 128 gpio irqs in 4 banks 86 | Console: colour dummy device 80x30 87 | console [ttyS0] enabled 88 | Calibrating delay loop... 149.91 BogoMIPS (lpj=749568) 89 | pid_max: default: 32768 minimum: 301 90 | Mount-cache hash table entries: 512 91 | CPU: Testing write buffer coherency: ok 92 | AT91: Power Management (with slow clock mode) 93 | AT91: Starting after power-restored wakeup 94 | bio: create slab at 0 95 | SCSI subsystem initialized 96 | usbcore: registered new interface driver usbfs 97 | usbcore: registered new interface driver hub 98 | usbcore: registered new device driver usb 99 | i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL) 100 | at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels 101 | Advanced Linux Sound Architecture Driver Version 1.0.24. 102 | Switching to clocksource tcb_clksrc 103 | NetWinder Floating Point Emulator V0.97 (double precision) 104 | JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. 105 | msgmni has been set to 120 106 | io scheduler noop registered (default) 107 | atmel_hlcdfb atmel_hlcdfb_base.0: 510KiB frame buffer at 23900000 (mapped at ffd80000) 108 | Console: switching to colour frame buffer device 60x34 109 | atmel_hlcdfb atmel_hlcdfb_base.0: fb0: Atmel LCDC at 0xf8038000 (mapped at c486e000), irq 25 110 | atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL 111 | brd: module loaded 112 | loop: module loaded 113 | ssc ssc.0: Atmel SSC device at 0xc4878000 (irq 28) 114 | atmel_nand atmel_nand: Using dma0chan0 for DMA transfers. 115 | nand_get_flash_type: second ID read did not match 30,30 against ff,00 116 | No NAND device found. 117 | atmel_spi atmel_spi.0: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers 118 | atmel_spi atmel_spi.0: Atmel SPI Controller at 0xf0000000 (irq 13) 119 | ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver 120 | at91_ohci at91_ohci: AT91 OHCI 121 | at91_ohci at91_ohci: new USB bus registered, assigned bus number 1 122 | at91_ohci at91_ohci: irq 22, io mem 0x00500000 123 | hub 1-0:1.0: USB hub found 124 | hub 1-0:1.0: 1 port detected 125 | Initializing USB Mass Storage driver... 126 | usbcore: registered new interface driver usb-storage 127 | USB Mass Storage support registered. 128 | usbcore: registered new interface driver libusual 129 | udc: at91_udc version 3 May 2006 130 | mousedev: PS/2 mouse device common for all mice 131 | input: gpio-keys as /devices/platform/gpio-keys/input/input0 132 | qt1070 0-001b: can not read register, returned -6 133 | qt1070 0-001b: ID -6 not supported 134 | atmel_tsadcc atmel_tsadcc: Master clock is set at: 100444438 Hz 135 | atmel_tsadcc atmel_tsadcc: Prescaler is set at: 166 136 | input: atmel touch screen controller as /devices/platform/atmel_tsadcc/input/input1 137 | at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0 138 | AT91 Real Time Clock driver. 139 | i2c /dev entries driver 140 | usbcore: registered new interface driver usbhid 141 | usbhid: USB HID core driver 142 | ASoC: Setting pck0 to 32768Hz 143 | wm8904-codec 0-001a: i2c_transfer() returned -6 144 | wm8904-codec 0-001a: Device is not a WM8904, ID is 0 145 | wm8904-codec 0-001a: asoc: failed to probe CODEC wm8904-codec.0-001a: -22 146 | asoc: failed to instantiate card WM8904 @ AT91SAM9N12: -22 147 | ASoC: at91sam9n12_init ok 148 | ALSA device list: 149 | No soundcards found. 150 | at91_rtc at91_rtc: setting system clock to 2007-01-01 00:28:55 UTC (1167611335) 151 | atmel_mci atmel_mci.0: Using dma0chan2 for DMA transfers 152 | atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots 153 | Waiting for root device /dev/sda2... 154 | usb 1-1: new full speed USB device number 2 using at91_ohci 155 | scsi0 : usb-storage 1-1:1.0 156 | scsi 0:0:0:0: Direct-Access OCZ DIESEL PMAP PQ: 0 ANSI: 0 CCS 157 | sd 0:0:0:0: [sda] 31326208 512-byte logical blocks: (16.0 GB/14.9 GiB) 158 | sd 0:0:0:0: [sda] Write Protect is off 159 | sd 0:0:0:0: [sda] Assuming drive cache: write through 160 | sd 0:0:0:0: [sda] Assuming drive cache: write through 161 | sda: detected capacity change from 0 to 16039018496 162 | sda: sda1 sda2 sda3 163 | sd 0:0:0:0: [sda] Assuming drive cache: write through 164 | sd 0:0:0:0: [sda] Attached SCSI removable disk 165 | VFS: Mounted root (ext2 filesystem) readonly on device 8:2. 166 | Freeing init memory: 124K 167 | /etc/init.d/rcS: line 1: mount: not found 168 | can't open /dev/tty4: No such file or directory 169 | can't open /dev/tty3: No such file or directory 170 | can't open /dev/tty2: No such file or directory 171 | can't open /dev/tty3: No such file or directory 172 | can't open /dev/tty2: No such file or directory 173 | can't open /dev/tty4: No such file or directory 174 | can't open /dev/tty2: No such file or directory 175 | 176 | BusyBox v1.23.1 (2015-03-16 01:57:27 PDT) multi-call binary. 177 | 178 | Usage: cat [FILE]... 179 | 180 | Concatenate FILEs and print them to stdout 181 | 182 | can't open /dev/tty3: No such file or directory 183 | can't open /dev/tty2: No such file or directory 184 | can't open /dev/tty4: No such file or directory 185 | can't open /dev/tty3: No such file or directory 186 | can't open /dev/tty2: No such file or directory 187 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/added-scripted-boot-to-U-Boot.txt: -------------------------------------------------------------------------------- 1 | ▒RomBOOT 2 | 3 | 4 | 5 | 6 | ============================== 7 | Using Dataflash! 8 | ba_offset = 0xb ... 9 | AT91Bootstrap 3.7.1-00054-gef803bb-dirty (Sun Mar 15 19:00:41 PDT 2015) 10 | Edited by hak8or! 11 | Yey custom code execution and toolchain verification! :D 12 | ======--======--======--====== 13 | MASTER_CLOCK (MCLK): 0x5f5e100 14 | SPI clock rate requested: 0xa1220 15 | scbr: 0x97 16 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 17 | SF: Copy 0x55500 bytes from 0x8400 to 0x20008400 18 | SF: Done loading image from SerialFlash 19 | Jumping to JUMP_ADDR (0x20008400) ... 20 | 21 | 22 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 15 2015 - 21:01:47) 23 | 24 | CPU: AT91SAM9N12 25 | Crystal frequency: 16 MHz 26 | CPU clock : 301.333 MHz 27 | Master clock : 100.444 MHz 28 | DRAM: 64 MiB 29 | WARNING: Caches not enabled 30 | NAND: atmel_nand: Fail to initialize #0 chip0 MiB 31 | MMC: mci: 0 32 | ** Bad device usb 0 ** 33 | Using default environment 34 | 35 | In: serial 36 | Out: serial 37 | Err: serial 38 | Net: ks8851_mll: Invalid chip id 0x30c0 39 | Board Net Initialization Failed 40 | No ethernet found. 41 | Hit any key to stop autoboot: 0 42 | (Re)start USB... 43 | USB0: scanning bus 0 for devices... 2 USB Device(s) found 44 | scanning usb for storage devices... 1 Storage Device(s) found 45 | reading uimage.bin 46 | 1978004 bytes read in 5317 ms (363.3 KiB/s) 47 | ## Booting kernel from Legacy Image at 20000000 ... 48 | Image Name: Linux-2.6.39 49 | Image Type: ARM Linux Kernel Image (uncompressed) 50 | Data Size: 1977940 Bytes = 1.9 MiB 51 | Load Address: 20008000 52 | Entry Point: 20008000 53 | Verifying Checksum ... OK 54 | Loading Kernel Image ... OK 55 | 56 | Starting kernel ... 57 | 58 | Uncompressing Linux... done, booting the kernel. 59 | Linux version 2.6.39 (wyang@bamboo) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #1 Fri Jan 13 10:57:53 CST 2012 60 | CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 61 | CPU: VIVT data cache, VIVT instruction cache 62 | Machine: Atmel AT91SAM9N12-EK 63 | Memory policy: ECC disabled, Data cache writeback 64 | Clocks: CPU 301 MHz, master 100 MHz, main 16.000 MHz 65 | Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 66 | Kernel command line: console=ttyS0,115200 mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256k(env),256k(env_redundant),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) 67 | PID hash table entries: 256 (order: -2, 1024 bytes) 68 | Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 69 | Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 70 | Memory: 64MB = 64MB total 71 | Memory: 60772k/60772k available, 4764k reserved, 0K highmem 72 | Virtual kernel memory layout: 73 | vector : 0xffff0000 - 0xffff1000 ( 4 kB) 74 | fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) 75 | DMA : 0xff000000 - 0xffe00000 ( 14 MB) 76 | vmalloc : 0xc4800000 - 0xfee00000 ( 934 MB) 77 | lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) 78 | modules : 0xbf000000 - 0xc0000000 ( 16 MB) 79 | .init : 0xc0008000 - 0xc002d000 ( 148 kB) 80 | .text : 0xc002d000 - 0xc03c2000 (3668 kB) 81 | .data : 0xc03c2000 - 0xc03e67c0 ( 146 kB) 82 | NR_IRQS:192 83 | AT91: 128 gpio irqs in 4 banks 84 | Console: colour dummy device 80x30 85 | console [ttyS0] enabled 86 | Calibrating delay loop... 149.91 BogoMIPS (lpj=749568) 87 | pid_max: default: 32768 minimum: 301 88 | Mount-cache hash table entries: 512 89 | CPU: Testing write buffer coherency: ok 90 | NET: Registered protocol family 16 91 | AT91: Power Management (with slow clock mode) 92 | AT91: Starting after power-restored wakeup 93 | bio: create slab at 0 94 | SCSI subsystem initialized 95 | usbcore: registered new interface driver usbfs 96 | usbcore: registered new interface driver hub 97 | usbcore: registered new device driver usb 98 | i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL) 99 | at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels 100 | Advanced Linux Sound Architecture Driver Version 1.0.24. 101 | Switching to clocksource tcb_clksrc 102 | NET: Registered protocol family 2 103 | IP route cache hash table entries: 1024 (order: 0, 4096 bytes) 104 | TCP established hash table entries: 2048 (order: 2, 16384 bytes) 105 | TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 106 | TCP: Hash tables configured (established 2048 bind 2048) 107 | TCP reno registered 108 | UDP hash table entries: 256 (order: 0, 4096 bytes) 109 | UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) 110 | NET: Registered protocol family 1 111 | RPC: Registered udp transport module. 112 | RPC: Registered tcp transport module. 113 | RPC: Registered tcp NFSv4.1 backchannel transport module. 114 | NetWinder Floating Point Emulator V0.97 (double precision) 115 | JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. 116 | msgmni has been set to 118 117 | io scheduler noop registered (default) 118 | atmel_hlcdfb atmel_hlcdfb_base.0: 510KiB frame buffer at 23980000 (mapped at ffd80000) 119 | Console: switching to colour frame buffer device 60x34 120 | atmel_hlcdfb atmel_hlcdfb_base.0: fb0: Atmel LCDC at 0xf8038000 (mapped at c486e000), irq 25 121 | atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL 122 | brd: module loaded 123 | loop: module loaded 124 | ssc ssc.0: Atmel SSC device at 0xc4878000 (irq 28) 125 | atmel_nand atmel_nand: Using dma0chan0 for DMA transfers. 126 | nand_get_flash_type: second ID read did not match 30,a0 against 00,00 127 | No NAND device found. 128 | atmel_spi atmel_spi.0: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers 129 | atmel_spi atmel_spi.0: Atmel SPI Controller at 0xf0000000 (irq 13) 130 | ks8851_mll ks8851_mll.0: (unregistered net_device): message enable is 0 131 | ks8851_mll ks8851_mll.0: (unregistered net_device): failed to read device ID 132 | ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver 133 | at91_ohci at91_ohci: AT91 OHCI 134 | at91_ohci at91_ohci: new USB bus registered, assigned bus number 1 135 | at91_ohci at91_ohci: irq 22, io mem 0x00500000 136 | hub 1-0:1.0: USB hub found 137 | hub 1-0:1.0: 1 port detected 138 | Initializing USB Mass Storage driver... 139 | usbcore: registered new interface driver usb-storage 140 | USB Mass Storage support registered. 141 | usbcore: registered new interface driver libusual 142 | udc: at91_udc version 3 May 2006 143 | mousedev: PS/2 mouse device common for all mice 144 | input: gpio-keys as /devices/platform/gpio-keys/input/input0 145 | qt1070 0-001b: can not read register, returned -6 146 | qt1070 0-001b: ID -6 not supported 147 | atmel_tsadcc atmel_tsadcc: Master clock is set at: 100444438 Hz 148 | atmel_tsadcc atmel_tsadcc: Prescaler is set at: 166 149 | input: atmel touch screen controller as /devices/platform/atmel_tsadcc/input/input1 150 | at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0 151 | AT91 Real Time Clock driver. 152 | i2c /dev entries driver 153 | usbcore: registered new interface driver usbhid 154 | usbhid: USB HID core driver 155 | ASoC: Setting pck0 to 32768Hz 156 | wm8904-codec 0-001a: i2c_transfer() returned -6 157 | wm8904-codec 0-001a: Device is not a WM8904, ID is 0 158 | wm8904-codec 0-001a: asoc: failed to probe CODEC wm8904-codec.0-001a: -22 159 | asoc: failed to instantiate card WM8904 @ AT91SAM9N12: -22 160 | ASoC: at91sam9n12_init ok 161 | ALSA device list: 162 | No soundcards found. 163 | TCP cubic registered 164 | NET: Registered protocol family 17 165 | Registering the dns_resolver key type 166 | at91_rtc at91_rtc: setting system clock to 2007-01-01 00:00:19 UTC (1167609619) 167 | atmel_mci atmel_mci.0: Using dma0chan2 for DMA transfers 168 | atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots 169 | Root-NFS: no NFS server address 170 | VFS: Unable to mount root fs via NFS, trying floppy. 171 | VFS: Cannot open root device "(null)" or unknown-block(2,0) 172 | Please append a correct "root=" boot option; here are the available partitions: 173 | Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/initial-working-U-Boot.txt: -------------------------------------------------------------------------------- 1 | Contents at 0x2005d8ec : 0xffffffff 2 | Contents at 0x2005d8f0 : 0xffffffff 3 | Contents at 0x2005d8f4 : 0xffffffff 4 | Contents at 0x2005d8f8 : 0xffffffff 5 | Contents at 0x2005d8fc : 0xffffffff 6 | Jumping to JUMP_ADDR (0x20008400) ... 7 | 8 | 9 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 15 2015 - 01:53:35) 10 | 11 | CPU: AT91SAM9N12 12 | Crystal frequency: 16 MHz 13 | CPU clock : 301.333 MHz 14 | Master clock : 100.444 MHz 15 | DRAM: 64 MiB 16 | WARNING: Caches not enabled 17 | NAND: atmel_nand: Fail to initialize #0 chip0 MiB 18 | MMC: mci: 0 19 | SF: Detected AT45DB081D with page size 256 Bytes, erase size 4 KiB, tot al 1 MiB 20 | *** Warning - bad CRC, using default environment 21 | 22 | In: serial 23 | Out: serial 24 | Err: serial 25 | Net: ks8851_mll: Invalid chip id 0x30c0 26 | Board Net Initialization Failed 27 | No ethernet found. 28 | Hit any key to stop autoboot: 0 29 | SF: Detected AT45DB081D with page size 256 Bytes, erase size 4 KiB, tot al 1 MiB 30 | ERROR: attempting read past flash size (0x100000) 31 | Wrong Image Format for bootm command 32 | ERROR: can't get kernel image! 33 | U-Boot>ls 34 | Unknown command 'ls' - try 'help' 35 | U-Boot> base 36 | Base Address: 0x00000000 37 | U-Boot> md 0 c 38 | 00000000: ea00000e ea000005 ea000005 ea000005 ................ 39 | 00000010: ea000005 00001ed0 ea000006 ea000006 ................ 40 | 00000020: eafffffe eafffffe eafffffe e25ef004 ..............^. 41 | U-Boot> help mtest 42 | Unknown command 'mtest' - try 'help' without arguments for list of all known commands 43 | 44 | U-Boot> help 45 | ? - alias for 'help' 46 | base - print or set address offset 47 | bdinfo - print Board Info structure 48 | boot - boot default, i.e., run 'bootcmd' 49 | bootd - boot default, i.e., run 'bootcmd' 50 | bootm - boot application image from memory 51 | bootp - boot image via network using BOOTP/TFTP protocol 52 | bootz - boot Linux zImage image from memory 53 | chpart - change active partition 54 | cls - clear screen 55 | cmp - memory compare 56 | coninfo - print console devices and information 57 | cp - memory copy 58 | crc32 - checksum calculation 59 | dhcp - boot image via network using DHCP/TFTP protocol 60 | echo - echo args to console 61 | editenv - edit environment variable 62 | env - environment handling commands 63 | exit - exit script 64 | false - do nothing, unsuccessfully 65 | fatinfo - print information about filesystem 66 | fatload - load binary file from a dos filesystem 67 | fatls - list files in a directory (default /) 68 | fdt - flattened device tree utility commands 69 | go - start application at address 'addr' 70 | help - print command description/usage 71 | iminfo - print header information for application image 72 | imxtract- extract a part of a multi-image 73 | itest - return true/false on integer compare 74 | loadb - load binary file over serial line (kermit mode) 75 | loads - load S-Record file over serial line 76 | loadx - load binary file over serial line (xmodem mode) 77 | loady - load binary file over serial line (ymodem mode) 78 | loop - infinite loop on address range 79 | md - memory display 80 | mm - memory modify (auto-incrementing address) 81 | mmc - MMC sub system 82 | mmcinfo - display MMC info 83 | mtdparts- define flash/nand partitions 84 | mw - memory write (fill) 85 | nand - NAND sub-system 86 | nboot - boot from NAND device 87 | nfs - boot image via network using NFS protocol 88 | nm - memory modify (constant address) 89 | ping - send ICMP ECHO_REQUEST to network host 90 | printenv- print environment variables 91 | reset - Perform RESET of the CPU 92 | run - run commands in an environment variable 93 | saveenv - save environment variables to persistent storage 94 | setenv - set environment variables 95 | sf - SPI flash sub-system 96 | showvar - print local hushshell variables 97 | sleep - delay execution for some time 98 | source - run script from memory 99 | test - minimal test like /bin/sh 100 | tftpboot- boot image via network using TFTP protocol 101 | true - do nothing, successfully 102 | usb - USB sub-system 103 | usbboot - boot from USB device 104 | version - print monitor, compiler and linker version 105 | U-Boot> sf 106 | sf - SPI flash sub-system 107 | 108 | Usage: 109 | sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus 110 | and chip select 111 | sf read addr offset len - read `len' bytes starting at 112 | `offset' to memory at `addr' 113 | sf write addr offset len - write `len' bytes from memory 114 | at `addr' to flash at `offset' 115 | sf erase offset [+]len - erase `len' bytes from `offset' 116 | `+len' round up `len' to block size 117 | sf update addr offset len - erase and write `len' bytes from memory 118 | at `addr' to flash at `offset' 119 | U-Boot> test 120 | U-Boot> md 0 c 121 | 00000000: ea00000e ea000005 ea000005 ea000005 ................ 122 | 00000010: ea000005 00001ed0 ea000006 ea000006 ................ 123 | 00000020: eafffffe eafffffe eafffffe e25ef004 ..............^. 124 | U-Boot> md 0 125 | 00000000: ea00000e ea000005 ea000005 ea000005 ................ 126 | 00000010: ea000005 00001ed0 ea000006 ea000006 ................ 127 | 00000020: eafffffe eafffffe eafffffe e25ef004 ..............^. 128 | U-Boot> help md 129 | md - memory display 130 | 131 | Usage: 132 | md [.b, .w, .l] address [# of objects] 133 | U-Boot> md 0 20 134 | 00000000: ea00000e ea000005 ea000005 ea000005 ................ 135 | 00000010: ea000005 00001ed0 ea000006 ea000006 ................ 136 | 00000020: eafffffe eafffffe eafffffe e25ef004 ..............^. 137 | 00000030: e1a00000 eafffffe eafffffe eafffffe ................ 138 | 00000040: e3a0d9c2 e59f40c4 e1a0e00f e12fff14 .....@......../. 139 | 00000050: e59f20bc e892001a e1530004 34912004 . ........S.. .4 140 | 00000060: 34832004 3afffffb e28f2098 e8920018 . .4...:. ...... 141 | 00000070: e3a02000 e1530004 34832004 3afffffc . ....S.. .4...: 142 | U-Boot> version 143 | 144 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 15 2015 - 01:53:35) 145 | arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278] 146 | GNU ld (GNU Tools for ARM Embedded Processors) 2.24.0.20141128 147 | U-Boot> usb 148 | usb - USB sub-system 149 | 150 | Usage: 151 | usb start - start (scan) USB controller 152 | usb reset - reset (rescan) USB controller 153 | usb stop [f] - stop USB [f]=force stop 154 | usb tree - show USB device tree 155 | usb info [dev] - show available USB devices 156 | usb test [dev] [port] [mode] - set USB 2.0 test mode 157 | (specify port 0 to indicate the device's upstream port) 158 | Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable] 159 | usb storage - show details of USB storage devices 160 | usb dev [dev] - show or set current USB storage device 161 | usb part [dev] - print partition table of one or all USB storage devices 162 | usb read addr blk# cnt - read `cnt' blocks starting at block `blk#' 163 | to memory address `addr' 164 | usb write addr blk# cnt - write `cnt' blocks starting at block `blk#' 165 | from memory address `addr' 166 | U-Boot> usb info 167 | USB is stopped. Please issue 'usb start' first. 168 | U-Boot> usb start 169 | (Re)start USB... 170 | USB0: scanning bus 0 for devices... 1 USB Device(s) found 171 | scanning usb for storage devices... 0 Storage Device(s) found 172 | U-Boot> usb info 173 | 1: Hub, USB Revision 1.10 174 | - U-Boot Root Hub 175 | - Class: Hub 176 | - PacketSize: 8 Configurations: 1 177 | - Vendor: 0x0000 Product 0x0000 Version 0.0 178 | Configuration: 1 179 | - Interfaces: 1 Self Powered 0mA 180 | Interface: 0 181 | - Alternate Setting 0, Endpoints: 1 182 | - Class Hub 183 | - Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms 184 | 185 | U-Boot> usb tree 186 | USB device tree: 187 | 1 Hub (12 Mb/s, 0mA) 188 | U-Boot Root Hub 189 | 190 | U-Boot> coninfo 191 | List of available devices: 192 | lcd 00000002 ..O 193 | serial 80000003 SIO stdin stdout stderr 194 | atmel_serial 00000003 .IO 195 | U-Boot> chpart 196 | Device nand0 not found! 197 | U-Boot> 198 | 199 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/kernel-booting-without-rootfs.txt: -------------------------------------------------------------------------------- 1 | U-Boot> usb tree 2 | USB device tree: 3 | 1 Hub (12 Mb/s, 0mA) 4 | | U-Boot Root Hub 5 | | 6 | +-2 Mass Storage (12 Mb/s, 100mA) 7 | OCZ DIESEL 50E69116000688 8 | 9 | U-Boot> usb storage 10 | Device 0: Vendor: OCZ Rev: PMAP Prod: DIESEL 11 | Type: Removable Hard Disk 12 | Capacity: 15296.0 MB = 14.9 GB (31326208 x 512) 13 | U-Boot> usb part 14 | 15 | Partition Map for USB device 0 -- Partition Type: DOS 16 | 17 | Part Start Sector Num Sectors UUID Type 18 | 1 1 31326206 00006cbc-01 0c Boot 19 | U-Boot> fatinfo 20 | usage: fatinfo [] 21 | U-Boot> fat info usb:1 22 | Unknown command 'fat' - try 'help' 23 | U-Boot> fatinfo usb:1 24 | ** No device specified ** 25 | U-Boot> fatinfo usb 0:1 26 | Interface: USB 27 | Device 0: Vendor: OCZ Rev: PMAP Prod: DIESEL 28 | Type: Removable Hard Disk 29 | Capacity: 15296.0 MB = 14.9 GB (31326208 x 512) 30 | Filesystem: FAT32 "NO NAME " 31 | U-Boot> fatls usb 0:1 32 | system volume information/ 33 | 1978004 uimage-2.6.39-m2-at91sam9n12ek.bin 34 | 35 | 1 file(s), 1 dir(s) 36 | 37 | U-Boot> fatload usb 0:1 0x20000000 38 | ** No boot file defined ** 39 | U-Boot> fatload usb 0:1 0x20000000 uimage-2.6.39-m2-at91sam9n12ek.bin 40 | reading uimage-2.6.39-m2-at91sam9n12ek.bin 41 | 1978004 bytes read in 5338 ms (361.3 KiB/s) 42 | U-Boot> bootm 43 | ## Booting kernel from Legacy Image at 20000000 ... 44 | Image Name: Linux-2.6.39 45 | Image Type: ARM Linux Kernel Image (uncompressed) 46 | Data Size: 1977940 Bytes = 1.9 MiB 47 | Load Address: 20008000 48 | Entry Point: 20008000 49 | Verifying Checksum ... OK 50 | Loading Kernel Image ... OK 51 | 52 | Starting kernel ... 53 | 54 | Uncompressing Linux... done, booting the kernel. 55 | Linux version 2.6.39 (wyang@bamboo) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3 -72) ) #1 Fri Jan 13 10:57:53 CST 2012 56 | CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 57 | CPU: VIVT data cache, VIVT instruction cache 58 | Machine: Atmel AT91SAM9N12-EK 59 | Memory policy: ECC disabled, Data cache writeback 60 | Clocks: CPU 301 MHz, master 100 MHz, main 16.000 MHz 61 | Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 62 | Kernel command line: console=ttyS0,115200 mtdparts=atmel_nand:256k(bootstrap)ro, 512k(uboot)ro,256k(env),256k(env_redundant),256k(spare),512k(dtb),6M(kernel)ro,- (rootfs) rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw 63 | PID hash table entries: 256 (order: -2, 1024 bytes) 64 | Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 65 | Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 66 | Memory: 64MB = 64MB total 67 | Memory: 60772k/60772k available, 4764k reserved, 0K highmem 68 | Virtual kernel memory layout: 69 | vector : 0xffff0000 - 0xffff1000 ( 4 kB) 70 | fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) 71 | DMA : 0xff000000 - 0xffe00000 ( 14 MB) 72 | vmalloc : 0xc4800000 - 0xfee00000 ( 934 MB) 73 | lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) 74 | modules : 0xbf000000 - 0xc0000000 ( 16 MB) 75 | .init : 0xc0008000 - 0xc002d000 ( 148 kB) 76 | .text : 0xc002d000 - 0xc03c2000 (3668 kB) 77 | .data : 0xc03c2000 - 0xc03e67c0 ( 146 kB) 78 | NR_IRQS:192 79 | AT91: 128 gpio irqs in 4 banks 80 | Console: colour dummy device 80x30 81 | console [ttyS0] enabled 82 | Calibrating delay loop... 149.91 BogoMIPS (lpj=749568) 83 | pid_max: default: 32768 minimum: 301 84 | Mount-cache hash table entries: 512 85 | CPU: Testing write buffer coherency: ok 86 | NET: Registered protocol family 16 87 | AT91: Power Management (with slow clock mode) 88 | AT91: Starting after power-restored wakeup 89 | bio: create slab at 0 90 | SCSI subsystem initialized 91 | usbcore: registered new interface driver usbfs 92 | usbcore: registered new interface driver hub 93 | usbcore: registered new device driver usb 94 | i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL) 95 | at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels 96 | Advanced Linux Sound Architecture Driver Version 1.0.24. 97 | Switching to clocksource tcb_clksrc 98 | NET: Registered protocol family 2 99 | IP route cache hash table entries: 1024 (order: 0, 4096 bytes) 100 | TCP established hash table entries: 2048 (order: 2, 16384 bytes) 101 | TCP bind hash table entries: 2048 (order: 1, 8192 bytes) 102 | TCP: Hash tables configured (established 2048 bind 2048) 103 | TCP reno registered 104 | UDP hash table entries: 256 (order: 0, 4096 bytes) 105 | UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) 106 | NET: Registered protocol family 1 107 | RPC: Registered udp transport module. 108 | RPC: Registered tcp transport module. 109 | RPC: Registered tcp NFSv4.1 backchannel transport module. 110 | NetWinder Floating Point Emulator V0.97 (double precision) 111 | JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. 112 | msgmni has been set to 118 113 | io scheduler noop registered (default) 114 | atmel_hlcdfb atmel_hlcdfb_base.0: 510KiB frame buffer at 23980000 (mapped at ffd 80000) 115 | Console: switching to colour frame buffer device 60x34 116 | atmel_hlcdfb atmel_hlcdfb_base.0: fb0: Atmel LCDC at 0xf8038000 (mapped at c486e 000), irq 25 117 | atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL 118 | brd: module loaded 119 | loop: module loaded 120 | ssc ssc.0: Atmel SSC device at 0xc4878000 (irq 28) 121 | atmel_nand atmel_nand: Using dma0chan0 for DMA transfers. 122 | nand_get_flash_type: second ID read did not match 30,a0 against 5e,5e 123 | No NAND device found. 124 | UBI error: ubi_init: UBI error: cannot initialize UBI, error -19 125 | atmel_spi atmel_spi.0: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfer s 126 | atmel_spi atmel_spi.0: Atmel SPI Controller at 0xf0000000 (irq 13) 127 | ks8851_mll ks8851_mll.0: (unregistered net_device): message enable is 0 128 | ks8851_mll ks8851_mll.0: (unregistered net_device): failed to read device ID 129 | ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver 130 | at91_ohci at91_ohci: AT91 OHCI 131 | at91_ohci at91_ohci: new USB bus registered, assigned bus number 1 132 | at91_ohci at91_ohci: irq 22, io mem 0x00500000 133 | hub 1-0:1.0: USB hub found 134 | hub 1-0:1.0: 1 port detected 135 | Initializing USB Mass Storage driver... 136 | usbcore: registered new interface driver usb-storage 137 | USB Mass Storage support registered. 138 | usbcore: registered new interface driver libusual 139 | udc: at91_udc version 3 May 2006 140 | mousedev: PS/2 mouse device common for all mice 141 | input: gpio-keys as /devices/platform/gpio-keys/input/input0 142 | qt1070 0-001b: can not read register, returned -6 143 | qt1070 0-001b: ID -6 not supported 144 | atmel_tsadcc atmel_tsadcc: Master clock is set at: 100444438 Hz 145 | atmel_tsadcc atmel_tsadcc: Prescaler is set at: 166 146 | input: atmel touch screen controller as /devices/platform/atmel_tsadcc/input/inp ut1 147 | at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0 148 | AT91 Real Time Clock driver. 149 | i2c /dev entries driver 150 | usbcore: registered new interface driver usbhid 151 | usbhid: USB HID core driver 152 | ASoC: Setting pck0 to 32768Hz 153 | wm8904-codec 0-001a: i2c_transfer() returned -6 154 | wm8904-codec 0-001a: Device is not a WM8904, ID is 0 155 | wm8904-codec 0-001a: asoc: failed to probe CODEC wm8904-codec.0-001a: -22 156 | asoc: failed to instantiate card WM8904 @ AT91SAM9N12: -22 157 | ASoC: at91sam9n12_init ok 158 | ALSA device list: 159 | No soundcards found. 160 | TCP cubic registered 161 | NET: Registered protocol family 17 162 | Registering the dns_resolver key type 163 | at91_rtc at91_rtc: setting system clock to 2007-01-01 00:09:37 UTC (1167610177) 164 | atmel_mci atmel_mci.0: Using dma0chan2 for DMA transfers 165 | atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots 166 | VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0) 167 | Please append a correct "root=" boot option; here are the available partitions: 168 | Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) 169 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/more-memtests.txt: -------------------------------------------------------------------------------- 1 | RomBOOT 2 | Start AT91Bootstrap... 3 | Init DDR... Done! 4 | Downloading image... 5 | detected dataflash id = 0x1f 0x25 0x0 0x1 0x0. 6 | Done! 7 | RomBOOT 8 | -I- -- NandFlash SAM-BA applet 2.14 -- 9 | -I- -- SAM9N12-EK 10 | -I- INIT command 11 | -I- Checking if NandIsOnficompatible. 12 | -I- Got bad ONFI response. :( 13 | -I- onfi_param_table[0]: 0x30 or 0 14 | -I- onfi_param_table[1]: 0xFF or ▒ 15 | -I- onfi_param_table[2]: 0xFF or ▒ 16 | -I- onfi_param_table[3]: 0xFF or ▒ 17 | -I- Checking if NandIsOnficompatible. 18 | -I- Got bad ONFI response. :( 19 | -I- onfi_param_table[0]: 0x20 or 20 | -I- onfi_param_table[1]: 0x20 or 21 | -I- onfi_param_table[2]: 0x20 or 22 | -I- onfi_param_table[3]: 0x20 or 23 | -I- Device Unknown due to no EBI detect 24 | -I- End of applet (command : 0 --- status : 1) 25 | -I- -- DataFlash AT45 Applet 2.14 -- 26 | -I- -- SAM9N12-EK 27 | -I- SPI and at45 drivers initialized 28 | -I- Device Unknown 29 | -I- End of applet (command : 0 --- status : 1) 30 | -I- -- DataFlash AT45 Applet 2.14 -- 31 | -I- -- SAM9N12-EK 32 | -I- SPI and at45 drivers initialized 33 | -I- AT45DB081D numPages : 0x1000 bufferAddr : 0x20008384 34 | -I- End of applet (command : 0 --- status : 0) 35 | 36 | 37 | ***** A bit later **** 38 | Comment: I can boot the AT91 bootstrap compiled by myself!! :D :D :D 39 | This means my toolchain is setup right and whatnot! 40 | Sadly it seems my u-boot isn't good, so time to fiddle a bit with that too. 41 | 42 | -I- End of applet (command : 3 --- status : 0) 43 | -I- READ at offset: 0x43080 buffer at : 0x20008384 of: 0x18c0 Bytes 44 | -I- READ return byte read : 0x18c0 Bytes 45 | -I- End of applet (command : 3 --- status : 0) 46 | -I- READ at offset: 0x44940 buffer at : 0x20008384 of: 0x448 Bytes 47 | -I- READ return byte read : 0x448 Bytes 48 | -I- End of applet (command : 3 --- status : 0) 49 | ▒RomBOOT 50 | 51 | 52 | AT91Bootstrap 3.7.1-00054-gef803bb (Tue Feb 24 22:17:05 PST 2015) 53 | 54 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 55 | SF: Copy 0x80000 bytes from 0x8400 to 0x26f00000 56 | SF: Done to load image 57 | 58 | 59 | AT91Bootstrap 3.7.1-00054-gef803bb (Tue Feb 24 22:17:05 PST 2015) 60 | 61 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 62 | SF: Copy 0x80000 bytes from 0x8400 to 0x26f00000 63 | SF: Done to load image 64 | 65 | **** And even later, checking if u-boot is loading correctly from dataflash **** 66 | ============================== 67 | Using Dataflash! 68 | ba_offset = 0xb ... 69 | AT91Bootstrap 3.7.1-00054-gef803bb-dirty (Wed Feb 25 12:32:18 PST 2015) 70 | Edited by hak8or! 71 | Yey custom code execution and toolchain verification! :D 72 | ======--======--======--====== 73 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 74 | SF: Copy 0x80000 bytes from 0x8400 to 0x22000000 75 | SF: Done to load image 76 | Contents at 0x22000000 : 0xffffffff 77 | 0xffffffff 78 | 0xffffffff 79 | Jumping to 0x22000000 ... 80 | 81 | **** later some more, adding better tests **** 82 | 83 | 84 | ============================== 85 | Using Dataflash! 86 | ba_offset = 0xb ... 87 | AT91Bootstrap 3.7.1-00054-gef803bb-dirty (Wed Feb 25 15:08:45 PST 2015) 88 | Edited by hak8or! 89 | Yey custom code execution and toolchain verification! :D 90 | ======--======--======--====== 91 | Doing a quick memory test (SAM-BA says all is ok but just incase) ... 92 | Contents at 0x22000000 : 0xeb00abc8 93 | Contents at 0x22000004 : 0xe3a01000 94 | Contents at 0x22000008 : 0xe3a02010 95 | Contents at 0x23fffff8 : 0x1234567 96 | Contents at 0x23fffffc : 0x1234567 97 | Writing 0xF0F0F0FA, 0xB1B2B3B4, and 0xB1B2B3B4 to JUMP_ADDR. 98 | Writing 0x01234567 to last two words in DRAM.. 99 | Contents at 0x22000000 : 0xf0f0f0fa 100 | Contents at 0x22000004 : 0xb1b2b3b4 101 | Contents at 0x22000008 : 0xb1b2b3b4 102 | Contents at 0x23fffff8 : 0x1234567 103 | Contents at 0x23fffffc : 0x1234567 104 | --- MEMORY TEST SUCCEDED! :D 105 | ---^^^^^^--- done with mem test 106 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 107 | SF: Copy 0x80000 bytes from 0x8400 to 0x22000000 108 | SF: Done to load image 109 | Contents at 0x22000000 : 0xeb00abc8 110 | Contents at 0x22000004 : 0xe3a01000 111 | Contents at 0x22000008 : 0xe3a02010 112 | Contents at 0x23fffff8 : 0x1234567 113 | Contents at 0x23fffffc : 0x1234567 114 | Jumping to JUMP_ADDR (0x22000000) ... -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/readme.md: -------------------------------------------------------------------------------- 1 | Just a collection of gists over time I made for this. Some are scripts some are output files. Left here for archival purposes. 2 | 3 | ### Bootloader efforts 4 | - [Large memory test](Large-Mem-Test.txt) 5 | - [Rough memtests added to at91 bootstrap](rough-memtests-added-to-at91-bootstrap.txt) 6 | - [More memtests](more-memtests.txt) 7 | - [Initial working U-Boot](initial-working-U-Boot.txt) 8 | 9 | ### U-Boot efforts 10 | - [USB working in U-Boot](USB-working-in-U-Boot.txt) 11 | - [Added scripted boot to U-Boot](added-scripted-boot-to-U-Boot.txt) 12 | 13 | ### Kernel efforts 14 | * [Kernel booting without rootfs](kernel-booting-without-rootfs.txt) 15 | 16 | ### Rootfs efforts 17 | - [Default busybox inittab spamming missing serial port](spamming-missing-serial-port.txt) 18 | - [Verifying Busybox execution](verifying-Busybox-execution.txt) 19 | - [Added inittab to Busybox](added-inittab-to-Busybox.txt) 20 | - [Sodoku execution](sodoku-execution.txt) 21 | - [Crosstools-NG output](Crosstools-NG-output.txt) 22 | - [First GCC attempt](first-GCC-attempt.txt) 23 | - [GCC compiles code on board](GCC-compilation.txt) 24 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/rough-memtests-added-to-at91-bootstrap.txt: -------------------------------------------------------------------------------- 1 | // Put me in display banner! 2 | char *version = "AT91Bootstrap"; 3 | char *ver_num = " "AT91BOOTSTRAP_VERSION" ("COMPILE_TIME")"; 4 | 5 | usart_puts(version); 6 | usart_puts(ver_num); 7 | usart_puts("\nEdited by hak8or!\n"); 8 | usart_puts("Yey custom code execution and toolchain verification! :D\n"); 9 | usart_puts("======--======--======--======\n"); 10 | 11 | 12 | 13 | // ============================================== 14 | // Used to see contents of data at address. 15 | int* data = JUMP_ADDR; 16 | int* DRAM_top = 0x24000000; 17 | 18 | dbg_info("Doing a quick memory test (SAM-BA says all is ok but just incase) ... \n"); 19 | 20 | dbg_info("Contents at %d : %d \n", JUMP_ADDR, *data); 21 | dbg_info("Contents at %d : %d \n", JUMP_ADDR + 4, *(data + 1)); 22 | dbg_info("Contents at %d : %d \n", JUMP_ADDR + 8, *(data + 2)); 23 | dbg_info("Contents at %d : %d \n", DRAM_top - 2, *(DRAM_top - 2)); 24 | dbg_info("Contents at %d : %d \n", DRAM_top - 1, *(DRAM_top - 1)); 25 | 26 | dbg_info("Writing 0xF0F0F0FA, 0xB1B2B3B4, and 0xB1B2B3B4 to JUMP_ADDR.\n"); 27 | dbg_info("Writing 0x01234567 to last two words in DRAM..\n"); 28 | 29 | *data = 0xF0F0F0FA; 30 | *(data + 1) = 0xB1B2B3B4; 31 | *(data + 2) = 0xB1B2B3B4; 32 | *(DRAM_top - 2) = 0x01234567; 33 | *(DRAM_top - 1) = 0x01234567; 34 | 35 | dbg_info("Contents at %d : %d \n", JUMP_ADDR, *data); 36 | dbg_info("Contents at %d : %d \n", JUMP_ADDR + 4, *(data + 1)); 37 | dbg_info("Contents at %d : %d \n", JUMP_ADDR + 8, *(data + 2)); 38 | dbg_info("Contents at %d : %d \n", DRAM_top - 2, *(DRAM_top - 2)); 39 | dbg_info("Contents at %d : %d \n", DRAM_top - 1, *(DRAM_top - 1)); 40 | 41 | if ( *data != 0xF0F0F0FA || *(data + 1) != 0xB1B2B3B4 || *(data + 2) != 0xB1B2B3B4 || *(DRAM_top - 2) != 0x01234567 || *(DRAM_top - 1) != 0x01234567) 42 | dbg_info(" --- MEMORY TEST FAILED! D: \n"); 43 | else 44 | dbg_info(" --- MEMORY TEST SUCCEDED! :D \n"); 45 | 46 | dbg_info("---^^^^^^--- done with mem test\n"); 47 | // Put me right before init_loadfunction(); 48 | // ============================================== -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/sodoku-execution.txt: -------------------------------------------------------------------------------- 1 | 2 | U-Boot> ▒▒▒▒▒RomBOOT 3 | 4 | 5 | 6 | 7 | ============================== 8 | Using Dataflash! 9 | ba_offset = 0xb ... 10 | AT91Bootstrap 3.7.1-00054-gef803bb-dirty (Sun Mar 15 19:00:41 PDT 2015) 11 | Edited by hak8or! 12 | Yey custom code execution and toolchain verification! :D 13 | ======--======--======--====== 14 | MASTER_CLOCK (MCLK): 0x5f5e100 15 | SPI clock rate requested: 0xa1220 16 | scbr: 0x97 17 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 18 | SF: Copy 0x55500 bytes from 0x8400 to 0x20008400 19 | SF: Done loading image from SerialFlash 20 | Jumping to JUMP_ADDR (0x20008400) ... 21 | 22 | 23 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 21 2015 - 13:50:41) 24 | 25 | CPU: AT91SAM9N12 26 | Crystal frequency: 16 MHz 27 | CPU clock : 301.333 MHz 28 | Master clock : 100.444 MHz 29 | DRAM: 64 MiB 30 | WARNING: Caches not enabled 31 | NAND: atmel_nand: Fail to initialize #0 chip0 MiB 32 | MMC: mci: 0 33 | ** Bad device usb 0 ** 34 | Using default environment 35 | 36 | In: serial 37 | Out: serial 38 | Err: serial 39 | Net: ks8851_mll: Invalid chip id 0x30c0 40 | Board Net Initialization Failed 41 | No ethernet found. 42 | Hit any key to stop autoboot: 0 43 | (Re)start USB... 44 | USB0: scanning bus 0 for devices... 2 USB Device(s) found 45 | scanning usb for storage devices... 1 Storage Device(s) found 46 | reading uimage.bin 47 | 1515300 bytes read in 4075 ms (362.3 KiB/s) 48 | ## Booting kernel from Legacy Image at 20000000 ... 49 | Image Name: linux-2.6 50 | Image Type: ARM Linux Kernel Image (uncompressed) 51 | Data Size: 1515236 Bytes = 1.4 MiB 52 | Load Address: 20008000 53 | Entry Point: 20008000 54 | Verifying Checksum ... OK 55 | Loading Kernel Image ... OK 56 | 57 | Starting kernel ... 58 | 59 | Uncompressing Linux... done, booting the kernel. 60 | Linux version 2.6.39 (hak8or@ubuntu) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #5 Mon Mar 16 07:24:35 EDT 2015 61 | CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 62 | CPU: VIVT data cache, VIVT instruction cache 63 | Machine: Atmel AT91SAM9N12-EK 64 | Memory policy: ECC disabled, Data cache writeback 65 | Clocks: CPU 301 MHz, master 100 MHz, main 16.000 MHz 66 | Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 67 | Kernel command line: console=ttyS0,115200 root=/dev/sda2 rootwait ro rootfstype=ext2 init=/bin/init 68 | PID hash table entries: 256 (order: -2, 1024 bytes) 69 | Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 70 | Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 71 | Memory: 64MB = 64MB total 72 | Memory: 61728k/61728k available, 3808k reserved, 0K highmem 73 | Virtual kernel memory layout: 74 | vector : 0xffff0000 - 0xffff1000 ( 4 kB) 75 | fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) 76 | DMA : 0xff000000 - 0xffe00000 ( 14 MB) 77 | vmalloc : 0xc4800000 - 0xfee00000 ( 934 MB) 78 | lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) 79 | modules : 0xbf000000 - 0xc0000000 ( 16 MB) 80 | .init : 0xc0008000 - 0xc0027000 ( 124 kB) 81 | .text : 0xc0027000 - 0xc02de000 (2780 kB) 82 | .data : 0xc02de000 - 0xc02fcac0 ( 123 kB) 83 | NR_IRQS:192 84 | AT91: 128 gpio irqs in 4 banks 85 | Console: colour dummy device 80x30 86 | console [ttyS0] enabled 87 | Calibrating delay loop... 149.91 BogoMIPS (lpj=749568) 88 | pid_max: default: 32768 minimum: 301 89 | Mount-cache hash table entries: 512 90 | CPU: Testing write buffer coherency: ok 91 | AT91: Power Management (with slow clock mode) 92 | AT91: Starting after power-restored wakeup 93 | bio: create slab at 0 94 | SCSI subsystem initialized 95 | usbcore: registered new interface driver usbfs 96 | usbcore: registered new interface driver hub 97 | usbcore: registered new device driver usb 98 | i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL) 99 | at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels 100 | Advanced Linux Sound Architecture Driver Version 1.0.24. 101 | Switching to clocksource tcb_clksrc 102 | NetWinder Floating Point Emulator V0.97 (double precision) 103 | JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. 104 | msgmni has been set to 120 105 | io scheduler noop registered (default) 106 | atmel_hlcdfb atmel_hlcdfb_base.0: 510KiB frame buffer at 23980000 (mapped at ffd80000) 107 | Console: switching to colour frame buffer device 60x34 108 | atmel_hlcdfb atmel_hlcdfb_base.0: fb0: Atmel LCDC at 0xf8038000 (mapped at c486e000), irq 25 109 | atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL 110 | brd: module loaded 111 | loop: module loaded 112 | ssc ssc.0: Atmel SSC device at 0xc4878000 (irq 28) 113 | atmel_nand atmel_nand: Using dma0chan0 for DMA transfers. 114 | No NAND device found. 115 | atmel_spi atmel_spi.0: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers 116 | atmel_spi atmel_spi.0: Atmel SPI Controller at 0xf0000000 (irq 13) 117 | ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver 118 | at91_ohci at91_ohci: AT91 OHCI 119 | at91_ohci at91_ohci: new USB bus registered, assigned bus number 1 120 | at91_ohci at91_ohci: irq 22, io mem 0x00500000 121 | hub 1-0:1.0: USB hub found 122 | hub 1-0:1.0: 1 port detected 123 | Initializing USB Mass Storage driver... 124 | usbcore: registered new interface driver usb-storage 125 | USB Mass Storage support registered. 126 | usbcore: registered new interface driver libusual 127 | udc: at91_udc version 3 May 2006 128 | mousedev: PS/2 mouse device common for all mice 129 | input: gpio-keys as /devices/platform/gpio-keys/input/input0 130 | qt1070 0-001b: can not read register, returned -6 131 | qt1070 0-001b: ID -6 not supported 132 | atmel_tsadcc atmel_tsadcc: Master clock is set at: 100444438 Hz 133 | atmel_tsadcc atmel_tsadcc: Prescaler is set at: 166 134 | input: atmel touch screen controller as /devices/platform/atmel_tsadcc/input/input1 135 | at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0 136 | AT91 Real Time Clock driver. 137 | i2c /dev entries driver 138 | usbcore: registered new interface driver usbhid 139 | usbhid: USB HID core driver 140 | ASoC: Setting pck0 to 32768Hz 141 | wm8904-codec 0-001a: i2c_transfer() returned -6 142 | wm8904-codec 0-001a: Device is not a WM8904, ID is 0 143 | wm8904-codec 0-001a: asoc: failed to probe CODEC wm8904-codec.0-001a: -22 144 | asoc: failed to instantiate card WM8904 @ AT91SAM9N12: -22 145 | ASoC: at91sam9n12_init ok 146 | ALSA device list: 147 | No soundcards found. 148 | at91_rtc at91_rtc: setting system clock to 2007-01-01 00:00:20 UTC (1167609620) 149 | atmel_mci atmel_mci.0: Using dma0chan2 for DMA transfers 150 | atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots 151 | Waiting for root device /dev/sda2... 152 | usb 1-1: new full speed USB device number 2 using at91_ohci 153 | scsi0 : usb-storage 1-1:1.0 154 | scsi 0:0:0:0: Direct-Access OCZ DIESEL PMAP PQ: 0 ANSI: 0 CCS 155 | sd 0:0:0:0: [sda] 31326208 512-byte logical blocks: (16.0 GB/14.9 GiB) 156 | sd 0:0:0:0: [sda] Write Protect is off 157 | sd 0:0:0:0: [sda] Assuming drive cache: write through 158 | sd 0:0:0:0: [sda] Assuming drive cache: write through 159 | sda: detected capacity change from 0 to 16039018496 160 | sda: sda1 sda2 161 | sd 0:0:0:0: [sda] Assuming drive cache: write through 162 | sd 0:0:0:0: [sda] Attached SCSI removable disk 163 | VFS: Mounted root (ext2 filesystem) readonly on device 8:2. 164 | Freeing init memory: 124K 165 | /bin/sh: can't access tty; job control turned off 166 | / # cd sbin/ 167 | /sbin # ls 168 | Sodoku fstrim main.cpp reboot 169 | acpid getty makedevs rmmod 170 | adjtimex halt mdev runlevel 171 | blkid hdparm mkdosfs setconsole 172 | blockdev hello_dyn_linked mke2fs start-stop-daemon 173 | bootchartd hello_stat_linked mkfs.ext2 sulogin 174 | depmod hwclock mkfs.minix swapoff 175 | devmem init mkfs.vfat swapon 176 | fbsplash insmod mkswap switch_root 177 | fdisk klogd modinfo sysctl 178 | findfs loadkmap modprobe syslogd 179 | freeramdisk logread pivot_root watchdog 180 | fsck losetup poweroff 181 | fsck.minix lsmod raidautorun 182 | /sbin # ./Sodoku 183 | Running self tests ... 184 | All tests passed (69 assertions in 18 test cases) 185 | 186 | Size of Sodoku puzzle: 4 187 | This is your empty sodoku puzzle. 188 | | . . . . | 189 | | . . . . | 190 | | . . . . | 191 | | . . . . | 192 | 193 | Lets fill 25% of it with some random yet valid starting cells. 194 | 195 | NOTE: 196 | Partial fill does not guarantee to supply a valid puzzle. This loop will try to find a solvable partially filled puzzle by trying to actually solve it and if it can't solve it, then it partially fills it again. 197 | 198 | Partially pre-filled puzzle. 199 | | . 1 . . | 200 | | 1 . . . | 201 | | . . . . | 202 | | . . 2 1 | 203 | 204 | Solved puzzle 205 | | 0 1 3 2 | 206 | | 1 2 0 3 | 207 | | 2 3 1 0 | 208 | | 3 0 2 1 | 209 | 210 | # of times a value was tried per cell. 211 | | 1 0 4 3 | 212 | | 0 3 6 4 | 213 | | 3 4 7 6 | 214 | | 4 1 0 0 | 215 | 216 | Whew! That took 46 steps! 217 | /sbin # 218 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/gists/verifying-Busybox-execution.txt: -------------------------------------------------------------------------------- 1 | RomBOOT 2 | 3 | 4 | 5 | 6 | ============================== 7 | Using Dataflash! 8 | ba_offset = 0xb ... 9 | AT91Bootstrap 3.7.1-00054-gef803bb-dirty (Sun Mar 15 19:00:41 PDT 2015) 10 | Edited by hak8or! 11 | Yey custom code execution and toolchain verification! :D 12 | ======--======--======--====== 13 | MASTER_CLOCK (MCLK): 0x5f5e100 14 | SPI clock rate requested: 0xa1220 15 | scbr: 0x97 16 | SF: Got Manufacturer and Device ID:0x1f 0x25 0x0 0x1 0x0 17 | SF: Copy 0x55500 bytes from 0x8400 to 0x20008400 18 | SF: Done loading image from SerialFlash 19 | Jumping to JUMP_ADDR (0x20008400) ... 20 | 21 | 22 | U-Boot 2014.07-00058-gb44bde2-dirty (Mar 16 2015 - 07:19:40) 23 | 24 | CPU: AT91SAM9N12 25 | Crystal frequency: 16 MHz 26 | CPU clock : 301.333 MHz 27 | Master clock : 100.444 MHz 28 | DRAM: 64 MiB 29 | WARNING: Caches not enabled 30 | NAND: atmel_nand: Fail to initialize #0 chip0 MiB 31 | MMC: mci: 0 32 | ** Bad device usb 0 ** 33 | Using default environment 34 | 35 | In: serial 36 | Out: serial 37 | Err: serial 38 | Net: ks8851_mll: Invalid chip id 0x30c0 39 | Board Net Initialization Failed 40 | No ethernet found. 41 | Hit any key to stop autoboot: 0 42 | U-Boot> usb start 43 | (Re)start USB... 44 | USB0: scanning bus 0 for devices... 2 USB Device(s) found 45 | scanning usb for storage devices... 1 Storage Device(s) found 46 | U-Boot> fatload usb 0:1 0x20000000 uimage.bin; bootm; 47 | reading uimage.bin 48 | 1515300 bytes read in 4077 ms (362.3 KiB/s) 49 | ## Booting kernel from Legacy Image at 20000000 ... 50 | Image Name: linux-2.6 51 | Image Type: ARM Linux Kernel Image (uncompressed) 52 | Data Size: 1515236 Bytes = 1.4 MiB 53 | Load Address: 20008000 54 | Entry Point: 20008000 55 | Verifying Checksum ... OK 56 | Loading Kernel Image ... OK 57 | 58 | Starting kernel ... 59 | 60 | Uncompressing Linux... done, booting the kernel. 61 | Linux version 2.6.39 (hak8or@ubuntu) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #5 Mon Mar 16 07:24:35 EDT 2015 62 | CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 63 | CPU: VIVT data cache, VIVT instruction cache 64 | Machine: Atmel AT91SAM9N12-EK 65 | Memory policy: ECC disabled, Data cache writeback 66 | Clocks: CPU 301 MHz, master 100 MHz, main 16.000 MHz 67 | Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 68 | Kernel command line: console=ttyS0,115200 root=/dev/sda2 rootwait ro rootfstype=ext2 init=/bin/init 69 | PID hash table entries: 256 (order: -2, 1024 bytes) 70 | Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) 71 | Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) 72 | Memory: 64MB = 64MB total 73 | Memory: 61728k/61728k available, 3808k reserved, 0K highmem 74 | Virtual kernel memory layout: 75 | vector : 0xffff0000 - 0xffff1000 ( 4 kB) 76 | fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB) 77 | DMA : 0xff000000 - 0xffe00000 ( 14 MB) 78 | vmalloc : 0xc4800000 - 0xfee00000 ( 934 MB) 79 | lowmem : 0xc0000000 - 0xc4000000 ( 64 MB) 80 | modules : 0xbf000000 - 0xc0000000 ( 16 MB) 81 | .init : 0xc0008000 - 0xc0027000 ( 124 kB) 82 | .text : 0xc0027000 - 0xc02de000 (2780 kB) 83 | .data : 0xc02de000 - 0xc02fcac0 ( 123 kB) 84 | NR_IRQS:192 85 | AT91: 128 gpio irqs in 4 banks 86 | Console: colour dummy device 80x30 87 | console [ttyS0] enabled 88 | Calibrating delay loop... 149.91 BogoMIPS (lpj=749568) 89 | pid_max: default: 32768 minimum: 301 90 | Mount-cache hash table entries: 512 91 | CPU: Testing write buffer coherency: ok 92 | AT91: Power Management (with slow clock mode) 93 | AT91: Starting after power-restored wakeup 94 | bio: create slab at 0 95 | SCSI subsystem initialized 96 | usbcore: registered new interface driver usbfs 97 | usbcore: registered new interface driver hub 98 | usbcore: registered new device driver usb 99 | i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL) 100 | at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels 101 | Advanced Linux Sound Architecture Driver Version 1.0.24. 102 | Switching to clocksource tcb_clksrc 103 | NetWinder Floating Point Emulator V0.97 (double precision) 104 | JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. 105 | msgmni has been set to 120 106 | io scheduler noop registered (default) 107 | atmel_hlcdfb atmel_hlcdfb_base.0: 510KiB frame buffer at 23900000 (mapped at ffd80000) 108 | Console: switching to colour frame buffer device 60x34 109 | atmel_hlcdfb atmel_hlcdfb_base.0: fb0: Atmel LCDC at 0xf8038000 (mapped at c486e000), irq 25 110 | atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL 111 | brd: module loaded 112 | loop: module loaded 113 | ssc ssc.0: Atmel SSC device at 0xc4878000 (irq 28) 114 | atmel_nand atmel_nand: Using dma0chan0 for DMA transfers. 115 | nand_get_flash_type: second ID read did not match 30,30 against ff,00 116 | No NAND device found. 117 | atmel_spi atmel_spi.0: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers 118 | atmel_spi atmel_spi.0: Atmel SPI Controller at 0xf0000000 (irq 13) 119 | ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver 120 | at91_ohci at91_ohci: AT91 OHCI 121 | at91_ohci at91_ohci: new USB bus registered, assigned bus number 1 122 | at91_ohci at91_ohci: irq 22, io mem 0x00500000 123 | hub 1-0:1.0: USB hub found 124 | hub 1-0:1.0: 1 port detected 125 | Initializing USB Mass Storage driver... 126 | usbcore: registered new interface driver usb-storage 127 | USB Mass Storage support registered. 128 | usbcore: registered new interface driver libusual 129 | udc: at91_udc version 3 May 2006 130 | mousedev: PS/2 mouse device common for all mice 131 | input: gpio-keys as /devices/platform/gpio-keys/input/input0 132 | qt1070 0-001b: can not read register, returned -6 133 | qt1070 0-001b: ID -6 not supported 134 | atmel_tsadcc atmel_tsadcc: Master clock is set at: 100444438 Hz 135 | atmel_tsadcc atmel_tsadcc: Prescaler is set at: 166 136 | input: atmel touch screen controller as /devices/platform/atmel_tsadcc/input/input1 137 | at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0 138 | AT91 Real Time Clock driver. 139 | i2c /dev entries driver 140 | usbcore: registered new interface driver usbhid 141 | usbhid: USB HID core driver 142 | ASoC: Setting pck0 to 32768Hz 143 | wm8904-codec 0-001a: i2c_transfer() returned -6 144 | wm8904-codec 0-001a: Device is not a WM8904, ID is 0 145 | wm8904-codec 0-001a: asoc: failed to probe CODEC wm8904-codec.0-001a: -22 146 | asoc: failed to instantiate card WM8904 @ AT91SAM9N12: -22 147 | ASoC: at91sam9n12_init ok 148 | ALSA device list: 149 | No soundcards found. 150 | at91_rtc at91_rtc: setting system clock to 2007-01-01 00:28:55 UTC (1167611335) 151 | atmel_mci atmel_mci.0: Using dma0chan2 for DMA transfers 152 | atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots 153 | Waiting for root device /dev/sda2... 154 | usb 1-1: new full speed USB device number 2 using at91_ohci 155 | scsi0 : usb-storage 1-1:1.0 156 | scsi 0:0:0:0: Direct-Access OCZ DIESEL PMAP PQ: 0 ANSI: 0 CCS 157 | sd 0:0:0:0: [sda] 31326208 512-byte logical blocks: (16.0 GB/14.9 GiB) 158 | sd 0:0:0:0: [sda] Write Protect is off 159 | sd 0:0:0:0: [sda] Assuming drive cache: write through 160 | sd 0:0:0:0: [sda] Assuming drive cache: write through 161 | sda: detected capacity change from 0 to 16039018496 162 | sda: sda1 sda2 sda3 163 | sd 0:0:0:0: [sda] Assuming drive cache: write through 164 | sd 0:0:0:0: [sda] Attached SCSI removable disk 165 | VFS: Mounted root (ext2 filesystem) readonly on device 8:2. 166 | Freeing init memory: 124K 167 | /etc/init.d/rcS: line 1: mount: not found 168 | can't open /dev/tty4: No such file or directory 169 | can't open /dev/tty3: No such file or directory 170 | can't open /dev/tty2: No such file or directory 171 | can't open /dev/tty3: No such file or directory 172 | can't open /dev/tty2: No such file or directory 173 | can't open /dev/tty4: No such file or directory 174 | can't open /dev/tty2: No such file or directory 175 | 176 | BusyBox v1.23.1 (2015-03-16 01:57:27 PDT) multi-call binary. 177 | 178 | Usage: cat [FILE]... 179 | 180 | Concatenate FILEs and print them to stdout 181 | 182 | can't open /dev/tty3: No such file or directory 183 | can't open /dev/tty2: No such file or directory 184 | can't open /dev/tty4: No such file or directory 185 | can't open /dev/tty3: No such file or directory 186 | can't open /dev/tty2: No such file or directory 187 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/linux/readme.md: -------------------------------------------------------------------------------- 1 | ### Getting started 2 | Config file *not* included, so do a menuconf to do any required changes (none are needed), and then run the approriate make commands: 3 | ``` 4 | make ARCH=arm at91sam9n12ek_defconfig 5 | make ARCH=arm menuconfig 6 | make ARCH=arm CROSS_COMPILE="put crosscompiler path here" 7 | mkimage -A arm -O linux -C none -T kernel -a 20008000 -e 20008000 -n linux-2.6 -d arch/arm/boot/zImage uImage.bin 8 | ``` 9 | 10 | Put the resulting uimage.bin into the primary partition of the USB flash drive. 11 | 12 | The [linux4sam linux page](http://www.at91.com/linux4sam/bin/view/Linux4SAM/LegacySAM9N12Page#Linux_Kernel) is a good resource for more help if needed. 13 | 14 | ### Dependancies 15 | - **Cross-Compiler:** Generate using Crosstools-NG (reccomended since you will have to make a cross-compiler eventually) or download from ARM's launchpad [here](https://launchpad.net/gcc-arm-embedded). 16 | 17 | - **Linux Kernel:** There are a good bit of required changes by atmel in the form of a patch to a very old ```2.6.39``` kernel, so upgrading to a more modern one is not very possible currently. 18 | ``` 19 | $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.bz2 20 | $ tar xvjf linux-2.6.39.tar.bz2 21 | $ cd linux-2.6.39 22 | ``` 23 | 24 | - **Linux Kernel patch:** Atmel require some patches before doing anything, which can handled by doing the following: 25 | ``` 26 | wget ftp://ftp.linux4sam.org/pub/linux/2.6.39-at91/2.6.39-at91sam9n12-exp.tar.gz 27 | tar xf 2.6.39-at91sam9n12-exp.tar.gz 28 | patch -p1 < u-boot-9n12_m2.patch 29 | ... 30 | patch -p1 < last_patch_file.path 31 | ``` 32 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/root_file_sys/gen_rootfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Resources: 4 | # http://pietrushnic.github.io/blog/2013/06/07/root-file-system-for-embedded-system/ 5 | # https://gist.github.com/eepp/6056325 6 | 7 | # Arguments: 8 | # none Compile busybox, make a rootfs from busybox and rootfs_additions, and get an ext2 fs from rootfs. 9 | # make_ext2 Just make an ext2 from the rootfs folder. 10 | # write_usb Same as none but also write the rootfs to a flash drive. 11 | 12 | # Allow the script to just remake the filesystem. 13 | if [[ $1 = "make_ext2" ]]; then 14 | make_ext2_fs 15 | 16 | exit 17 | fi 18 | 19 | # Make an ext2 root filesystem image. 20 | make_ext2_fs() { 21 | echo -n "Making an ext2 rootfs called rootfs.ext2 ... " 22 | # Make a 20 MB empty file to hold the image 23 | dd if=/dev/zero of=../rootfs.ext2 bs=1M count=500 24 | 25 | # Make that file use an ext2 FS. 26 | mkfs.ext2 ../rootfs.ext2 27 | 28 | # Make a dir for mounting the rootfs image too 29 | rm -r -f ../rootfs_ext2_mountpoint 30 | mkdir ../rootfs_ext2_mountpoint 31 | 32 | # Mount the rootfs to that point. 33 | mount ../rootfs.ext2 ../rootfs_ext2_mountpoint 34 | 35 | # Copy all the stuff from the rootfs folder. 36 | cp -a ../rootfs/* ../rootfs_ext2_mountpoint 37 | 38 | # Unmount 39 | umount ../rootfs_ext2_mountpoint 40 | 41 | echo "OK" 42 | } 43 | 44 | # Delete the _install dir if it exists to make sure we have a clean slate. 45 | if [ -d _install ]; then 46 | echo -n "Wiping _install ..." 47 | rm -r -f _install 48 | echo "OK" 49 | fi 50 | 51 | # Delete the rootfs dir if it exists to make sure we have a clean slate. 52 | if [ -d ../rootfs ]; then 53 | echo -n "Wiping ../rootfs ..." 54 | rm -r -f ../rootfs 55 | echo "OK" 56 | fi 57 | 58 | # Compile busybox and setup symlinking. Seems that make install recompiles busybox if it doesn't exist in _install. 59 | make ARCH=arm CROSS_COMPILE=/home/hak8or/Desktop/sam9n12/toolchain_codesourcery/arm-2014.05/bin/arm-none-linux-gnueabi- install -j3 60 | 61 | # Make the rootfs dir. 62 | mkdir -p ../rootfs 63 | 64 | # Copy busybox's entire rootfs including all the symlinks over to our rootfs. 65 | cp -a _install/* ../rootfs/ 66 | 67 | # ========================================================== 68 | # ========================================================== 69 | # Non busybox mods to the roofs 70 | # ========================================================== 71 | # ========================================================== 72 | # We need the libraries from the toolchain like libc and libstdc++ for dynamic linking. 73 | # Put them in /lib and /usr/lib. Get rid of the locals folder, it's massive and not needed. 74 | # 75 | # The libs can be found in these places in the toolchains sysroot folder. 76 | 77 | # Make sure the dir exists to hold stuff we want to manually add to the rootfs 78 | mkdir -p ../rootfs_additions 79 | 80 | # And copy everything from the dir where we hold manually added stuff. 81 | cp -a ../rootfs_additions/* ../rootfs 82 | 83 | # Make the base dirs of the root file system. The -p creates dirs where needed. 84 | mkdir -p ../rootfs/bin ../rootfs/dev ../rootfs/proc ../rootfs/sys ../rootfs/etc/init.d 85 | 86 | # Gives us a file system running from flash, and a file system running from ram. 87 | mkdir -p ../rootfs/mnt/flashfs ../rootfs/mnt/ramfs 88 | 89 | # And where we will store content for the user. 90 | mkdir -p ../rootfs/usr/home/hello_world 91 | 92 | # A short hello world for the user. 93 | touch ../rootfs/usr/home/hello_world/hello.cpp 94 | cat <<'EOF' >> ../rootfs/usr/home/hello_world/hello.cpp 95 | #include 96 | 97 | int main(void) { 98 | std::cout << "Hello world!\n"; 99 | return 0; 100 | } 101 | EOF 102 | 103 | # Make a few important nodes. The numbers are associated with sym-links inside /sys/dev/char/ 104 | mknod ../rootfs/dev/console c 5 1 105 | mknod ../rootfs/dev/null c 1 3 106 | mknod ../rootfs/dev/ttyAMA0 c 204 64 107 | mknod ../rootfs/dev/zero c 1 5 108 | 109 | # Makes an initab file to handle booting. 110 | touch ../rootfs/etc/inittab 111 | cat <<'EOF' >> ../rootfs/etc/inittab 112 | ::sysinit:/etc/init.d/rcS 113 | ::respawn:/bin/sh 114 | ::ctrlaltdel:/sbin/reboot 115 | ::shutdown:/sbin/swapoff -a 116 | ::shutdown:/bin/umount -a -r 117 | ::restart:/sbin/init 118 | EOF 119 | 120 | # And an init.d/rcS 121 | touch ../rootfs/etc/init.d/rcS 122 | cat <<'EOF' >> ../rootfs/etc/init.d/rcS 123 | #! /bin/sh 124 | mount -t proc proc /proc 125 | mount -t sysfs sysfs /sys 126 | 127 | # Writable mount points. 128 | mount -t ramfs -o size=5m ramfs /mnt/ramfs -w 129 | EOF 130 | chmod +x ../rootfs/etc/init.d/rcS 131 | 132 | # And add in an init manually. 133 | # Check if we still need to do this or if busybox install does this for us. 134 | ln -s busybox ../rootfs/bin/init 135 | 136 | # Generate a root filesystem ext2 based image. Commented out since we 137 | # aren't using this currently. This will be later used for a JIFFS or 138 | # cramfs or whatever type of FS on flash. 139 | # make_ext2_fs 140 | 141 | # Copy the rootfs over to our flash drive. 142 | if [[ $1 = "write_usb" ]]; then 143 | echo -n "Copying to flash drive ... " 144 | 145 | # Wipe whatever was on the flash drive to make sure everything is clean 146 | rm -r -f /media/hak8or/95ba7c1e-6ecc-4bd4-9519-4d7e05c7e0fe/*; sync 147 | 148 | # Copy the rootfs over to our flash drive and sync to make sure it was writte too. 149 | cp -a ../rootfs/* /media/hak8or/95ba7c1e-6ecc-4bd4-9519-4d7e05c7e0fe/; sync 150 | 151 | echo "OK" 152 | fi 153 | 154 | # And say we are done. 155 | echo "And we are done :D" 156 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/root_file_sys/readme.md: -------------------------------------------------------------------------------- 1 | ### Getting started 2 | The rootfs is relativly simple to setup depending on how much you functionality you want. 3 | 4 | Also, [this](https://gist.github.com/eepp/6056325) amazing gist shows how to handle a rootfs with busybox, and while it's for the beaglebone the process is nearly indentical for sam9n12 after the kernel steps. 5 | 6 | #### Just Busybox 7 | If all you want is busybox and nothing else, then : 8 | - statically compile busybox and run a ```make install``` 9 | - Copy the contents of busybox's _install into rootfs_additions using ```cp -a```, the ```-a``` flag also copies the required symlinks 10 | - Make a few device nodes 11 | ``` 12 | mknod rootfs/dev/console c 5 1 13 | mknod rootfs/dev/null c 1 3 14 | mknod rootfs/dev/ttyAMA0 c 204 64 15 | ``` 16 | - Make an inittab to prevent the ttyS# spam in the terminal. 17 | ``` 18 | touch rootfs/etc/inittab 19 | cat <<'EOF' >> rootfs/etc/inittab 20 | ::sysinit:/etc/init.d/rcS 21 | ::respawn:/bin/sh 22 | ::ctrlaltdel:/sbin/reboot 23 | ::shutdown:/sbin/swapoff -a 24 | ::shutdown:/bin/umount -a -r 25 | ::restart:/sbin/init 26 | EOF 27 | ``` 28 | - Make an rcS: ```touch rootfs/etc/init.d/rcS && chmod +x rootfs/etc/init.d/rcS``` 29 | 30 | #### Busybux + other applications 31 | If you plan on adding other applications, do as above but don't comple busybox statically. Then also copy the contents of the rootfs dir from your cross compiler and add your aplications to somewhere like ```/usr/home/cross_compiled_bin/```. If you will use dynamic linking for your applications and not use normal libraries in normal locations, then add the new library locations to ```/etc/ld.so.conf``` so the kernels dynamic linker can see them. 32 | 33 | #### Busybux + other applications + gcc 34 | If you want to also add gcc, then all you need to do in addition to above is just copy the gcc base dir such as ```arm-none-linux-gnueabi``` to someplace like ```/usr/home/toolchain/```. Compiling things just requires calling ```arm-none-linux-gnueabi-g++ file.cpp``` like normal gcc operations. Make sure to remove ```locales``` since we don't need them and they take up a monsterous 150MB+. 35 | 36 | Assuming gcc is in ```/usr/home/toolchain/```, then you can add a symlink of g++ into ```/bin``` by doing the following which lets you compile by doing ```g++ main.cpp```: 37 | 38 | ```symlink /bin/g++ /usr/home/toolchain/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++``` 39 | 40 | #### Script 41 | There is a script which will do all of what is above automatically for you: 42 | - Compile busybox. 43 | - Copy the contents of the busybox _install dir into the rootfs. 44 | - Make a hello world source file in ```/usr/home/hello_world/```. 45 | - Generate device nodes such as ```/dev/zero``` and ```/dev/ttyACM0```. 46 | - Generate an ```inittab``` which prevent the ttyS# spam in the terminal. 47 | - Generate an ```rcS``` which gets the kernel to populate ```/sys``` and ```/proc``` dir's and make a 5MB ramfs in /ramfs. 48 | - Combine the rootfs_additions folder into the roofs. 49 | - Optionally make an ext2 based image of the rootfs. 50 | - Optionally write the rootfs into the correct partition of the USB flash drive. 51 | 52 | This script needs to be run under sudo currently, so ```sudo ./gen_rootfs.sh write_usb``` will do the above and write the image to the flash drive. -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/cross_tool_bins/Sodoku_crosstools_dyn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/cross_tool_bins/Sodoku_crosstools_dyn -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/cross_tool_bins/hello_cross_tool_dyn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/cross_tool_bins/hello_cross_tool_dyn -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/cross_tool_bins/hello_cross_tool_static: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/cross_tool_bins/hello_cross_tool_static -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/root_file_sys/rootfs_additions/usr/home/hello_world/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | std::cout << "Hello World! :o\n"; 5 | 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/u-boot/0001-Relocating-U-Boot-change-128-to-64MB-USB-boot.patch: -------------------------------------------------------------------------------- 1 | From 97ede670caba41c1dcff8137c119776c1ef34e17 Mon Sep 17 00:00:00 2001 2 | From: hak8or 3 | Date: Fri, 27 Mar 2015 03:07:48 -0400 4 | Subject: [PATCH] Relocating U-Boot, change 128 to 64MB, USB boot 5 | 6 | --- 7 | boards.cfg | 1 + 8 | include/configs/at91sam9n12ek.h | 41 ++++++++++++++++++++++++++++++++++------- 9 | 2 files changed, 35 insertions(+), 7 deletions(-) 10 | 11 | diff --git a/boards.cfg b/boards.cfg 12 | index 9e4cf24..31b12ca 100644 13 | --- a/boards.cfg 14 | +++ b/boards.cfg 15 | @@ -111,6 +111,7 @@ Active arm arm926ejs at91 atmel at91sam9m10g45ek 16 | Active arm arm926ejs at91 atmel at91sam9n12ek at91sam9n12ek_mmc at91sam9n12ek:AT91SAM9N12,SYS_USE_MMC Josh Wu 17 | Active arm arm926ejs at91 atmel at91sam9n12ek at91sam9n12ek_nandflash at91sam9n12ek:AT91SAM9N12,SYS_USE_NANDFLASH Josh Wu 18 | Active arm arm926ejs at91 atmel at91sam9n12ek at91sam9n12ek_spiflash at91sam9n12ek:AT91SAM9N12,SYS_USE_SPIFLASH Josh Wu 19 | +Active arm arm926ejs at91 atmel at91sam9n12ek at91sam9n12ek_USB at91sam9n12ek:AT91SAM9N12,SYS_USE_USBFLASH Marcin Z 20 | Active arm arm926ejs at91 atmel at91sam9rlek at91sam9rlek_mmc at91sam9rlek:AT91SAM9RL,SYS_USE_MMC Stelian Pop 21 | Active arm arm926ejs at91 atmel at91sam9rlek at91sam9rlek_dataflash at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH Stelian Pop 22 | Active arm arm926ejs at91 atmel at91sam9rlek at91sam9rlek_nandflash at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH Stelian Pop 23 | diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h 24 | index f02fce9..e1d8f19 100644 25 | --- a/include/configs/at91sam9n12ek.h 26 | +++ b/include/configs/at91sam9n12ek.h 27 | @@ -16,7 +16,7 @@ 28 | */ 29 | #include 30 | 31 | -#define CONFIG_SYS_TEXT_BASE 0x26f00000 32 | +#define CONFIG_SYS_TEXT_BASE 0x20008400 // Where U-Boot expects to be executing from. 33 | 34 | /* ARM asynchronous clock */ 35 | #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 /* slow clock xtal */ 36 | @@ -43,7 +43,7 @@ 37 | #define CONFIG_BAUDRATE 115200 38 | 39 | /* LCD */ 40 | -#define CONFIG_LCD 41 | +// #define CONFIG_LCD // Disable LCD since no need to use uneeded pins and waste code size. 42 | #define LCD_BPP LCD_COLOR16 43 | #define LCD_OUTPUT_BPP 24 44 | #define CONFIG_LCD_LOGO 45 | @@ -82,9 +82,10 @@ 46 | #define CONFIG_CMD_FAT 47 | #define CONFIG_CMD_USB 48 | 49 | -#define CONFIG_NR_DRAM_BANKS 1 50 | +#define CONFIG_NR_DRAM_BANKS 1 // Shouldn't this be 4 banks? Though I have read online that 51 | + // sometimes this is faked to make memory handling easier. 52 | #define CONFIG_SYS_SDRAM_BASE 0x20000000 53 | -#define CONFIG_SYS_SDRAM_SIZE 0x08000000 54 | +#define CONFIG_SYS_SDRAM_SIZE 0x04000000 // Changed from 0x08.. (128MB) to 0x04.. (64MB) 55 | 56 | /* 57 | * Initial stack pointer: 4k - GENERATED_GBL_DATA_SIZE in internal SRAM, 58 | @@ -138,7 +139,8 @@ 59 | "console=console=ttyS0,115200\0" \ 60 | "mtdparts="MTDPARTS_DEFAULT"\0" \ 61 | "bootargs_nand=rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw\0"\ 62 | - "bootargs_mmc=root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait\0" 63 | + "bootargs_mmc=root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait\0"\ 64 | + "bootargs_usb=root=/dev/sda2 rootwait rw rootfstype=ext2 init=/bin/init" 65 | 66 | /* MMC */ 67 | #ifdef CONFIG_CMD_MMC 68 | @@ -156,10 +158,11 @@ 69 | #define CONFIG_KS8851_MLL 70 | #define CONFIG_KS8851_MLL_BASEADDR 0x30000000 /* use NCS2 */ 71 | 72 | -#define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ 73 | +#define CONFIG_SYS_LOAD_ADDR 0x20000000 /* load address for where to put the linux kernel */ 74 | 75 | #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE 76 | -#define CONFIG_SYS_MEMTEST_END 0x26e00000 77 | +#define CONFIG_SYS_MEMTEST_END 0x200000FF /* Changed from 0x26e00000 to accomodate 64 MB instead 78 | + of 128 MB and U-Boot sitting at 0x20008400 */ 79 | 80 | /* USB host */ 81 | #ifdef CONFIG_CMD_USB 82 | @@ -198,6 +201,30 @@ 83 | "nand read 0x22000000 0x200000 0x400000;" \ 84 | "bootm 0x22000000 - 0x21000000" 85 | 86 | + 87 | +/* 88 | + ## ## ###### ######## 89 | + ## ## ## ## ## ## 90 | + ## ## ## ## ## 91 | + ## ## ###### ######## 92 | + ## ## ## ## ## 93 | + ## ## ## ## ## ## 94 | + ####### ###### ######## 95 | +*/ 96 | + 97 | +#elif defined(CONFIG_SYS_USE_USBFLASH) 98 | +/* bootstrap + u-boot + in Dataflash, Linux in flash drive */ 99 | +#define CONFIG_ENV_IS_IN_USB 100 | +#define FAT_ENV_DEVICE_AND_PART "0:1" 101 | +#define FAT_ENV_FILE "uboot.env" 102 | +#define FAT_ENV_INTERFACE "usb" 103 | +#define CONFIG_ENV_IS_IN_FAT 104 | +#define CONFIG_FAT_WRITE 105 | +#define CONFIG_ENV_SIZE 0x4000 106 | +#define CONFIG_BOOTCOMMAND \ 107 | + "setenv bootargs ${console} ${bootargs_usb};" \ 108 | + "usb start; fatload usb 0:1 0x20000000 uimage.bin; bootm;" 109 | + 110 | #else /* CONFIG_SYS_USE_MMC */ 111 | 112 | /* bootstrap + u-boot + env + linux in mmc */ 113 | -- 114 | 2.1.0 115 | 116 | -------------------------------------------------------------------------------- /AT91SAM9N12/OldSchool/u-boot/readme.md: -------------------------------------------------------------------------------- 1 | ### Getting started 2 | Config file *not* included, so first apply my patch, do a menuconf to verify memory addresses are correct, and then run the approriate make commands: 3 | ``` 4 | git apply 0001-Relocating-U-Boot-change-128-to-64MB-USB-boot.patch 5 | make at91sam9n12ek_USB_config 6 | make arch=ARM CROSS_COMPILE="put crosscompiler path here" menuconf 7 | make arch=ARM CROSS_COMPILE="put crosscompiler path here" 8 | ``` 9 | 10 | Using SAM-BA, dump ```uboot.bin``` to dataflash at ```0x8400``` using the the save file option. 11 | 12 | The [linux4sam U-Boot page](http://www.at91.com/linux4sam/bin/view/Linux4SAM/U-Boot) is a good resource for more help if needed. 13 | 14 | Check ```u-boot.map``` to verify that u-boot is expecting itself in the correct place in memory. 15 | 16 | ### Targets for config 17 | - ```at91sam9n12ek_mmc``` 18 | - ```at91sam9n12ek_nandflash``` 19 | - ```at91sam9n12ek_spiflash``` 20 | - ```at91sam9n12ek_USB``` <-- Use this if not using config file. 21 | 22 | ### Dependancies 23 | - **Cross-Compiler:** Generate using Crosstools-NG (reccomended since you will have to make a cross-compiler eventually) or download from ARM's launchpad [here](https://launchpad.net/gcc-arm-embedded). 24 | 25 | - **U-Boot:** You can get the new newest U-Boot official source but going to an old git tag is required. 26 | ``` 27 | git clone http://git.denx.de/u-boot.git 28 | cd u-boot && git checkout v2011.06 -b yourbranch 29 | ``` 30 | Or an archive already at the correct branch and everything. 31 | ``` 32 | wget ftp://ftp.denx.de/pub/u-boot/u-boot-2011.06.tar.bz2 33 | tar xf u-boot-2011.06.tar.bz2 34 | ``` 35 | 36 | - **U-Boot patch:** Atmel require a patch to U-Boot before doing anything, which can handled by doing the following: 37 | ``` 38 | wget ftp://ftp.linux4sam.org/pub/uboot/u-boot-v2011.06/u-boot-9n12_m2.patch 39 | patch -p1 < u-boot-9n12_m2.patch 40 | ``` 41 | 42 | ### Changes outline 43 | - **Board configuration** 44 | - **LCD:** The LCD functionality was disabled to save code size and remove unnecessary pin I/O state changes. 45 | - **64MB vs 128 MB:** There is only 64 MB of DRAM on my board compared to 128MB on the evel kit. 46 | - **Memory test:** U-Boot automatically tests memory upon bootup, decreased the region memory is tested to just 128 bytes since we already know memory works correctly, to save boot time, and there is only have as much RAM so this had to change anyways. 47 | - **U-Boot address (text base):** U-Boot by default is inserted into the last megabyte of DRAM via a hardcoded address, but I decided to stick it in ```0x20008400``` (DRAM memory base is ```0x20000000```) to not keep mixing up with it's location in dataflash which is at ```0x8400```, and because the last megabyte for 64MB of DRAM is diffirant than 128MB. Somehow loading the linux kernel into the memory at it's base doesn't overwrite U-Boot, just noticed. *Whoops* 48 | - **Sys load address:** Where the kernel gets loaded into, changed from ```0x22000000``` to DRAM base, somehow not crashing U-Boot in the process. 49 | - **Boot options** 50 | - **USB boot option:** Properly added to ```boards.cfg``` and ```include/configs/at91sam9n12ek.h``` the ability to boot from USB by starting usb, loading the kernel off USB into memory, and starting the kernel with boot arguments to get the rootfs off USB too. 51 | 52 | The above changes are in the patch file, apply it using ```git apply patch-file.patch```. 53 | -------------------------------------------------------------------------------- /AT91SAM9N12/Packages.md: -------------------------------------------------------------------------------- 1 | # Making things better 2 | 3 | The end goal is to have the system be fairly usable, with the list from before being: 4 | 5 | - [x] Boot to a shell and be able to communicate with it over serial 6 | - [x] Read only file system with compression (SquashFS) 7 | - [x] Networking support 8 | - [x] Use the RNX-N150HG USB Wifi dongle to talk to the outside world 9 | - [ ] curl 10 | - [ ] htop 11 | - [ ] stress 12 | - [ ] tmux 13 | - [ ] SSH Server 14 | - [ ] Nano 15 | 16 | As of now, the system can boot into a shell and recognize USB devices, specifically our Wifi dongle. Future changes to the system involve userspace instead of kernel space, hence the divide. We will call this a minimal configuration for our system, which if you want to replicate just follow the [replicating documentation](replicate.md). 17 | 18 | ## Musl vs Glibc vs uClibc-ng 19 | 20 | There are three main c standard library implementations out there, each with it's own pro's and con's. [Glibc](https://www.gnu.org/software/libc/libc.html) (GNU C Library) is the big most popular and therefore the "standard". uClibc-ng (a fork of [uClibc](https://www.uclibc.org/FAQ.html#doesnt_suck)) a smaller version of GlibC which removes various (very non relevant for Embedded Systems) backwards compatibility in favor of space. [Musl](https://www.musl-libc.org/intro.html) is a new implementation of the C STDLib under a more permissive and open source friendly license, in addition to being an attempt at writing a new implementation with modern practices in mind. There is a [great](http://www.etalabs.net/compare_libcs.html) comparison which goes over specific differences between these three implementations. This can be changed in buildroot in the ```Toolchain``` entry. Since we are targeting a very small system in terms of flash, we have to see which of these is smaller. This is without any packages yet, so it is really just the size of the stdlib itself. 21 | 22 | | Type | zImage Total | RootFS Total | RootFS Delta | 23 | | --------- | ------------ | ------------ | ------------ | 24 | | uClibc-ng | 1658 kB | 964 kB | 0 kB | 25 | | Glibc | 1657 kB | 1720 kB | +760 kB | 26 | | Musl | 1658 kB | 1036 kB | +76 kB | 27 | 28 | If we just worry about size then you would think, hey, lets go with uClibc-ng, right? To that I say, good luck getting locale to work, and therefore tmux. Instead, in our case we will go with Musl. It's very well supported, has tons of functionality similar to Glibc (refer to previously mentioned comparison chart), and is only 76 kB bigger than uClibc-ng. Most importantly, after spending a few hours trying to get locales to run with uClibc-ng to get tmux to work, I gave up and went with Musl. So Musl it is! 29 | 30 | ## HTTP Webserver 31 | 32 | Buildroot supports a few HTTP webservers, such as Nginx, but we need a small one that can fit in our tiny flash space. Here are a few I looked at and their associated size increase of the zImage. 33 | 34 | | Package | Summary | RootFS Delta | 35 | | :------------- | :---------------------------------------------------------------------------------------------- | :----------: | 36 | | lighthttpd | Very active even today, lots of features. | 212 kB | 37 | | Nginx | Everyone knows nginx, this removed everything except static file hosting. | 146 kB | 38 | | uhttpd | Written by OpenWRT people, handles CGI and IPv6. | 56 kB | 39 | | thttpd | Last commit was in 2014, simple, and supports CGI + IPv6. | 36 kB | 40 | | Boa | Discontinued in 2005. | 20 kB | 41 | | DarkHttp | Last commit was in 2016, simple, no CGI, and supports IPv6. | 60 kB | 42 | | tinyhttpd | Many versions under this name, shouldn't be used for production. Ridiculously simple and tiny. | 1 kB | 43 | 44 | ## Packages 45 | 46 | Buildroot also does a fantastic job of dependancy management. It can tell what packages need what libraries or other software and adds it for you. To start off, lets add htop, a great alternative to top which adds colors and just makes visually far more usable. In the buildroot directory, just do ```make nconfig``` and go into ```target packages->System tools``` to enable the htop package. You can also just search for symbols when using nconfig with the F8 key. Afterwards just run make and done. Htop adds 156 kB to our compressed root file system. 47 | 48 | Repeating this process for the other packages, here is what the size of each package is when added to our root file system. 49 | 50 | | Package | Summary | RootFS Delta | 51 | | :------------- | :------------------------------------------------------------------------------------------------------------------------- | :----------: | 52 | | WPA_Supplicant | To connect to wireless networks. | 408 kB | 53 | | Tmux | Great for when we want to need two or more terminals at once. | 336 kB | 54 | | Htop | Vastly prefer over top, used to tell what the state of the system is. | 156 kB | 55 | | LibCurl + Curl | Interfacing with web API's. | 148 kB | 56 | | Dropbear + Zlib | Allows us to run an SSH server on our board. Requires Zlib (only 32 kB), 76 kB with or without "Client Programs". | 108 kB | 57 | | Nano | Helpful little text editor. | 60 kB | 58 | | Dhrystone | Can be fun to use for very rough benchmarking. | 4 kB | 59 | | Stress | Stress test the system for IO, CPU, Memory, etc. Sadly can't use stress-ng because we aren't using GlibC due to it's size. | 4 kB | 60 | 61 | ## Tmux 62 | 63 | Tmux requires a UTF-8 locale instead of our current ASCII locale. What is a locale you ask? It is a bunch of information in a file which tells the system what region you are in and therefore what symbols to use for your currency, how to display your time, how to display numbers (comma vs dot for digit groupings), and other formatting which differs across countries. This also tends to be accompanied with the characters themselves. 64 | 65 | If tmux is ran without the proper locale setup, then you are greeted with this ```tmux: need UTF-8 locale (LC_CTYPE) but have ASCII```. 66 | 67 | ## Drop Bear 68 | 69 | Since we have network connectivity, we might as well include the ability to connect to the device over SSH, and connect to other devices over SSH. SSH'ing into a system requires either key or password based authentication, but that gives us an issue. Our root file system is read only, and we do not have a overlay to allow writing to it. Therefore, we cannot just create a new user in the running file system or add a password, because both require writing to the file system. Instead, we can have buildroot add a password to the root user under ```System configuration->Root password```. Right now it's set to "pass". 70 | -------------------------------------------------------------------------------- /AT91SAM9N12/SAMBA.md: -------------------------------------------------------------------------------- 1 | # SAM-BA 2 | 3 | ## The heck is SAM-BA? 4 | 5 | So we have our board working enough to get the in ROM bootloader running, great! But how do we actually get some code onto DataFlash, and what about booting into Linux? Most importantly, what about initializing DRAM? 6 | 7 | Thankfully, almost all vendors release tools that interact with software in ROM. These tools can use the software in ROM to initialize DRAM, erase flash on DataFlash, NandFlash, NOR Flash, and even modify OTP (One Time Programmable) bits in the IC. Atmel's tool for the AT91 series of chips is called SAM-BA, of which they have two versions. First is an open source command line only [version](https://github.com/atmelcorp/sam-ba) which while looking fantastic (yay for scripting), it doesn't support our old SAM9N12, and adding support doesn't seem trivial. 8 | 9 | Next is the version we will be using, the original GUI version from [here](http://www.at91.com/linux4sam/bin/view/Linux4SAM/SoftwareTools#SAM_BA). The documentation for SAM-BA by Atmel is fantastic in terms of how to download it and get it running, so no use for me to say what's been said there other than giving a small summary. 10 | 11 | SAM-BA works by you plugging in a USB cable from your desktop to the AT91SAM SOC's USB Device port (the board looks like a device from the perspective of your machine, not the opposite). The SAM-BA tool will communicate with the ROM based bootloader by using a mailbox-esque setup with some shared memory in SRAM of the SOC. The user can write "applets" (just ARM executables) which SAM-BA sends to DRAM and executes on the device. These applets can be used to initialize DRAM or modify NAND Flash. Atmel also helpfully includes an easy way to modify these applets and then recompile them. 12 | 13 | ## DRAM and DataFlash 14 | 15 | DRAM is necessary because almost all the applets are designed to run from DRAM instead of SRAM. When starting SAM-BA, the tool automatically initializes DRAM and seems to do a quick small check to ensure DRAM is working, but you can manually call DRAM initialization anyways. 16 | 17 | ![SAM-BA DRAM Init](images/SAM-BA_DRAM.PNG) 18 | 19 | You can also send a file (don't use just 0's or 1's, use random data as below) to DRAM and then have SAM-BA do a comparison to further verify DRAM's functionality with your board design. 20 | 21 | ```bash 22 | # Create one megabyte of random data using DD. 23 | dd if=/dev/urandom of=randomstuff.bin bs=1 count=4M 24 | ``` 25 | 26 | Next up we have to flash some data to dataflash (32 Megabits) to ensure that is working. Why not NAND flash since we have so much more of it? Even after ensuring the pin setup is correct (NAND Flash is on diffirent pins than DRAM as per evaluation board), communication fails. This is likely due to soldering issues of the BGA package. 27 | 28 | Using the random data generated earlier, flash that to DataFlash (after running "Enable Dataflash") and then do a compare to ensure Dataflash is working reliably. Don't skip this or you may end up spending nights debugging the wrong thing as your storage medium being faulty leads to all sorts of very hard to track down bugs. 29 | 30 | ![SAM-BA Dataflash verification](images/SAM-BA_Dataflash.PNG) 31 | -------------------------------------------------------------------------------- /AT91SAM9N12/buildroot.md: -------------------------------------------------------------------------------- 1 | # Buildroot 2 | 3 | ## The heck is Buildroot? 4 | 5 | ![Buldroot Example](images/Buildroot_Example.PNG) 6 | 7 | The [Old School](OldSchool/readme.md) guide shows how to set the kernel and root file system up by hand which, while a great learning experience, is extremely tedious and error prone. A few years ago amongst an enormous mass of custom shell and python scripts in an attempt to automate this process, the community decided to make [BuildRoot](https://buildroot.org/). This automates all of the following for you; 8 | 9 | - Downloading and compiling a toolchain 10 | - Downloading and cross compiling the kernel, Busybox, packages for rootFS 11 | - Dependency management for packages 12 | - Wrappers for menuconfig of Busybox, Linux, and more 13 | - Optionally can handle AT91 Bootstrap and U-Boot 14 | - Creates a root file system (and even compresses it) 15 | - Wrapped up in makefiles which support ```nconfig``` and ```xconfig``` 16 | 17 | In short, Busybox is an amazing tool that takes all the pain out of setting up a Linux based system. What about [Yocto](https://www.yoctoproject.org/)? I didn't get a chance to actually try it out yet, so Buildroot it is! 18 | 19 | Going back to our original goal, we want a minimal system that can fit in under 4 Megabytes. This means no xorg (no graphical interface), no package manager, no Python or Ruby, only the basic necessities. Conceptually we need three different items, the Linux Kernel, the Root File System (ROOTFS, contains Busybox and our applications), and the Device Tree. Since the root file system will remain on the SPI based device flash, the kernel needs the driver for the SPI peripheral on our SOC. 20 | 21 | To get Buildroot, you can use the [site](https://buildroot.org/download.html) and extract the archive. 22 | 23 | ```bash 24 | # Download the package 25 | wget https://buildroot.org/downloads/buildroot-2018.02.1.tar.gz 26 | 27 | # Extract the File (tar -xf, lack of z flag autodetects file type) 28 | tar -xf buildroot-2018.02.1.tar.gz 29 | ``` 30 | 31 | ## Defconfig 32 | 33 | Buildroot also makes use of [defconfig's](https://stackoverflow.com/questions/41885015/what-exactly-does-linux-kernels-make-defconfig-do) (default configurations), which you can find by just doing a simple ```find```. 34 | 35 | ```bash 36 | [hak8or@hak8or buildroot-2018.02.1]$ find . -name "*defconfig" | grep "at91" 37 | ./output/build/linux-headers-4.13/arch/arm/configs/at91_dt_defconfig 38 | ./output/build/linux-4.13/arch/arm/configs/at91_dt_defconfig 39 | ./configs/at91sam9x5ek_mmc_dev_defconfig 40 | ./configs/at91sam9260eknf_defconfig 41 | ... 42 | ``` 43 | 44 | Sadly there is no defconfig for our specific board. Usually it's sufficient to just find and adapt the closest defconfig and use that instead, specifically using the same CPU core (```AT91SAM9N12``` uses an ```ARM926EJ-S``` ), but let's try to do this ourselves to see what a defconfig could include. Afterwards, the current configuration of buildroot can be saved as a defconfig which will allow to use a simple ```make defconfig BR2_DEFCONFIG=/home/hak8or/BrainyV2_buildroot_minimal_defconfig``` to automatically select everything mentioned below. 45 | 46 | ## Our Tiny Defconfig 47 | 48 | As said earlier, this SOC uses an ```ARM926EJ-S``` based core running at 400 Mhz with 64 MB of DDR2 SDRAM. When running ```make nconfig``` at the root of the Buildroot directory, go to ```Target Options ---> Target Architecture``` and select ```ARM Little Endian```. To set the actual CPU core, go to ```Target Options ---> Target Architecture Variant``` and select ```arm926t``` (yes, we actually have the "EJ-S" variant but this works fine). 49 | 50 | We want the Linux kernel of course, so in the ```Kernel --->``` tab enable the kernel which should populate the kernel version field with ```4.15``` (as of Q1 2018). Instead, change the ```Kernel Version``` field to ```Custom version``` and type in ```4.15.18```. This is because later we will apply a few patches to the kernel. The linux kernel itself does have a default config for our SOC so select ```in-tree defconfig file``` and type ```at91_dt``` in the "Defconfig Name" field. This configuration has the kernel include various drivers for Atmels AT91SAM series of IC's and assumes a device tree will be appended to the kernel image. 51 | 52 | For the ```Toolchain --->``` tab, select both ```Enable C++ support``` because we will need that later for many applications. I would suggest also selecting to use the latest ```binutils``` and ```GCC```. 53 | 54 | Next up is the device tree we made [earlier](devicetree.md). Create a file called ```BrainyV2.dts``` in the Linux kernel source folder (in my case being ```output/build/linux-4.15.7/arch/arm/boot/dts/```) containing that device tree. In the Kernel tab, enable ```Build a Device Tree Blob```, select ```Use a device tree present in the kernel``` and for the file name put ```BrainyV2``` (yes, there is no file extension included even though it says file name). This will have the kernel build process create a file in the ```output/images``` folder for the compiled device tree with the ```.dtb``` file extension instead of us having to do this manually. 55 | 56 | We will be making use of a Wifi dongle which requires a 3rd party, closed source, firmware binary blob. The linux kernel keeps these out of it's tree and instead has a separate tree just for these [here](https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/). Devices like Wifi dongles, GPU's, and other "complicated" hardware often times have firmware which must be loaded at boot, and sadly most of the time it's closed source. Inside buildroot we can specify for it to download the binary blob and put it into a standard location (```/lib/firmware```) by going in ```Target Packages->Hardware Handling->Firmware->Linux-firmware->Wifi firmware->Atheros 9271```. 57 | 58 | Lastly, we only have 4 MB for everything so compression is extremely important. For the root file system we do not need it to be writable, so we can use [SquashFS](https://elinux.org/Squash_FS_Howto). This file system was designed specifically for space constrained systems and has tons of awesome features but has one large issue, it's read only. Also, the [xz](https://tukaani.org/xz/format.html) compression format seems to do the best on my system in terms of compression ratio. To enable the root file system to use squashfs with xz, go to ```Filesystem images --->``` and select ```squashfs root filesystem``` with ```Compression algorithm (xz)```. For the kernel, go to ```Kernel --->``` and ensure the ```Kernel binary format``` is a ```zImage``` with the compression set to ```zx compression```. 59 | 60 | To summarize, here is what you need to change: 61 | 62 | ```none 63 | Buildroot nconfig 64 | Target Options 65 | Target Architecture = ARM Little Endian 66 | Target Architecture Variant = arm926t 67 | Kernel 68 | Enabled 69 | Kernel Version = Custom Version (4.15.18) 70 | Kernel Configuration = in-tree defconfig file 71 | Defconfig name = at91_dt 72 | Kernel compression format = xz compression 73 | Build a Device Tree Blob = Checked 74 | Use a device tree present in the kernel 75 | Device Tree Source file names = BrainyV2 76 | Filesystem images 77 | tar the root filesystem = unchecked 78 | squashfs = checked 79 | Compression algorithm = xz 80 | Toolchain 81 | Binutils Version = 2.3 82 | GCC compiler Version = 7.x 83 | Enable C++ support = checked 84 | Target Packages 85 | Hardware Handling 86 | Firmware 87 | Linux-firmware 88 | WiFi firmware 89 | Atheros 9271 = checked 90 | ``` 91 | 92 | Run ```make``` and wait a while. This will download and compile for GCC (our cross compiler), the Linux kernel, Busybox, tools for the host, create a root file system, and lastly create images for both the Kernel and the root file system. This will take a pretty long time (half an hour on an I5-3570k OC'd to 4.6 Ghz running from an SSD and 4.5 GB RAM), so go grab an espresso in the meantime. 93 | 94 | ## Size Restrictions 95 | 96 | At this point you should have a kernel and root file system that is only ```3.9 Megabytes``` large. 97 | 98 | ```bash 99 | [hak8or@hak8or buildroot-2018.02]$ ls -lh output/images/ 100 | total 3.9M 101 | -rw-r--r-- 1 hak8or users 18K Apr 2 17:34 at91sam9n12ek_custom.dtb 102 | -rw-r--r-- 1 hak8or users 1.2M Apr 2 17:34 rootfs.squashfs 103 | -rw-r--r-- 1 hak8or users 2.7M Apr 2 17:34 zImage 104 | ``` 105 | 106 | This has everything we need to boot, but remember that we only have 4 MB to play with. Given our earlier size constraints for the root file system (```2.217 MB```) and kernel (```1.846 MB```), the kernel (```2.7M```) won't fit. [Next](smallerzimage.md) up is looking into what we can remove in order to decrease in size. 107 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/BrainyV2.dts: -------------------------------------------------------------------------------- 1 | /* 2 | * at91sam9n12ek.dts - Device Tree file for AT91SAM9N12-EK board 3 | * 4 | * Copyright (C) 2012 Atmel, 5 | * 2012 Hong Xu 6 | * 7 | * Licensed under GPLv2 or later. 8 | */ 9 | /dts-v1/; 10 | #include "at91sam9n12.dtsi" 11 | 12 | / { 13 | model = "Atmel AT91SAM9N12-EK"; 14 | compatible = "atmel,at91sam9n12ek", "atmel,at91sam9n12", "atmel,at91sam9"; 15 | 16 | memory { 17 | reg = <0x20000000 0x4000000>; 18 | }; 19 | 20 | clocks { 21 | main_xtal { 22 | clock-frequency = <16000000>; 23 | }; 24 | }; 25 | 26 | ahb { 27 | apb { 28 | dbgu: serial@fffff200 { 29 | status = "okay"; 30 | }; 31 | 32 | spi0: spi@f0000000 { 33 | status = "okay"; 34 | cs-gpios = <&pioA 14 0>, <0>, <0>, <0>; 35 | flash@0 { 36 | status = "okay"; 37 | compatible = "atmel,at45"; 38 | spi-max-frequency = <25000000>; 39 | reg = <0>; 40 | 41 | partitions { 42 | compatible = "fixed-partitions"; 43 | #address-cells = <1>; 44 | #size-cells = <1>; 45 | 46 | partition@0 { 47 | label = "AT91Bootstrap"; 48 | reg = <0x00 0x26D8>; 49 | read-only; 50 | }; 51 | 52 | partition@2800 { 53 | label = "DeviceTree"; 54 | reg = <0x2800 0x4B00>; 55 | read-only; 56 | }; 57 | 58 | partition@7300 { 59 | label = "zImage"; 60 | reg = <0x7300 0x1D8D00>; 61 | read-only; 62 | }; 63 | 64 | partition@1E0000 { 65 | label = "RootFS"; 66 | reg = <0x1E0000 0x237C00>; 67 | read-only; 68 | }; 69 | 70 | partition@417C00 { 71 | label = "NonVolatile"; 72 | reg = <0x417C00 0x8400>; 73 | }; 74 | }; 75 | }; 76 | }; 77 | }; 78 | 79 | usb0: ohci@500000 { 80 | num-ports = <1>; 81 | status = "okay"; 82 | }; 83 | }; 84 | }; 85 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/BrainyV2_AT91Bootstrap.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/BrainyV2_AT91Bootstrap.bin -------------------------------------------------------------------------------- /AT91SAM9N12/configs/BrainyV2_AT91Bootstrap_defconfig: -------------------------------------------------------------------------------- 1 | CONFIG_AT91SAM9N12EK=y 2 | # CONFIG_DATAFLASH_RECOVERY is not set 3 | CONFIG_LOAD_LINUX=y 4 | CONFIG_OVERRIDE_CMDLINE=y 5 | CONFIG_LINUX_KERNEL_ARG_STRING="console=ttyS0,115200 root=/dev/mtdblock3" 6 | CONFIG_IMG_ADDRESS="0x007300" 7 | CONFIG_OF_OFFSET="0x00002800" 8 | CONFIG_THUMB=y 9 | # CONFIG_SCLK is not set 10 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/BrainyV2_buildroot_full_defconfig: -------------------------------------------------------------------------------- 1 | BR2_arm=y 2 | BR2_TOOLCHAIN_BUILDROOT_MUSL=y 3 | BR2_BINUTILS_VERSION_2_30_X=y 4 | BR2_GCC_VERSION_7_X=y 5 | BR2_TOOLCHAIN_BUILDROOT_CXX=y 6 | BR2_TARGET_GENERIC_ROOT_PASSWD="pass" 7 | BR2_LINUX_KERNEL=y 8 | BR2_LINUX_KERNEL_CUSTOM_VERSION=y 9 | BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.15.18" 10 | BR2_LINUX_KERNEL_PATCH="/home/hak8or/clk-at91-PLL-recalc_rate-now-using-cached-MUL-and-DI.patch /home/hak8or/USB-Bogus-Pipe-warning-rate-limited.patch" 11 | BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y 12 | BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="/home/hak8or/BrainyV2_kernel_defconfig" 13 | BR2_LINUX_KERNEL_XZ=y 14 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 15 | BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/home/hak8or/BrainyV2.dts" 16 | BR2_PACKAGE_DHRYSTONE=y 17 | BR2_PACKAGE_STRESS=y 18 | BR2_PACKAGE_LINUX_FIRMWARE=y 19 | BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y 20 | BR2_PACKAGE_LIBCURL=y 21 | BR2_PACKAGE_CURL=y 22 | BR2_PACKAGE_DROPBEAR=y 23 | BR2_PACKAGE_WPA_SUPPLICANT=y 24 | BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y 25 | BR2_PACKAGE_TMUX=y 26 | BR2_PACKAGE_HTOP=y 27 | BR2_PACKAGE_NANO=y 28 | BR2_TARGET_ROOTFS_SQUASHFS=y 29 | BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y 30 | # BR2_TARGET_ROOTFS_TAR is not set -------------------------------------------------------------------------------- /AT91SAM9N12/configs/BrainyV2_buildroot_minimal_defconfig: -------------------------------------------------------------------------------- 1 | BR2_arm=y 2 | BR2_TOOLCHAIN_BUILDROOT_MUSL=y 3 | BR2_BINUTILS_VERSION_2_30_X=y 4 | BR2_GCC_VERSION_7_X=y 5 | BR2_TOOLCHAIN_BUILDROOT_CXX=y 6 | BR2_LINUX_KERNEL=y 7 | BR2_LINUX_KERNEL_CUSTOM_VERSION=y 8 | BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.15.18" 9 | BR2_LINUX_KERNEL_PATCH="/home/hak8or/clk-at91-PLL-recalc_rate-now-using-cached-MUL-and-DI.patch /home/hak8or/USB-Bogus-Pipe-warning-rate-limited.patch" 10 | BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y 11 | BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="/home/hak8or/BrainyV2_kernel_defconfig" 12 | BR2_LINUX_KERNEL_XZ=y 13 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 14 | BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/home/hak8or/BrainyV2.dts" 15 | BR2_PACKAGE_LINUX_FIRMWARE=y 16 | BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y 17 | BR2_PACKAGE_WPA_SUPPLICANT=y 18 | BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y 19 | BR2_TARGET_ROOTFS_SQUASHFS=y 20 | BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y 21 | # BR2_TARGET_ROOTFS_TAR is not set 22 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/BrainyV2_kernel_defconfig: -------------------------------------------------------------------------------- 1 | # CONFIG_LOCALVERSION_AUTO is not set 2 | CONFIG_KERNEL_XZ=y 3 | # CONFIG_SWAP is not set 4 | CONFIG_SYSVIPC=y 5 | CONFIG_LOG_BUF_SHIFT=14 6 | CONFIG_BLK_DEV_INITRD=y 7 | # CONFIG_RD_GZIP is not set 8 | # CONFIG_RD_BZIP2 is not set 9 | # CONFIG_RD_LZMA is not set 10 | # CONFIG_RD_LZO is not set 11 | # CONFIG_RD_LZ4 is not set 12 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y 13 | CONFIG_KALLSYMS_ALL=y 14 | CONFIG_EMBEDDED=y 15 | CONFIG_SLAB=y 16 | CONFIG_STRICT_KERNEL_RWX=y 17 | CONFIG_STRICT_MODULE_RWX=y 18 | CONFIG_MODULES=y 19 | CONFIG_MODULE_UNLOAD=y 20 | # CONFIG_BLK_DEV_BSG is not set 21 | # CONFIG_IOSCHED_DEADLINE is not set 22 | # CONFIG_IOSCHED_CFQ is not set 23 | # CONFIG_ARCH_MULTI_V7 is not set 24 | CONFIG_ARCH_AT91=y 25 | CONFIG_SOC_AT91SAM9=y 26 | CONFIG_AEABI=y 27 | CONFIG_KEXEC=y 28 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 29 | # CONFIG_SUSPEND is not set 30 | CONFIG_NET=y 31 | CONFIG_PACKET=y 32 | CONFIG_UNIX=y 33 | CONFIG_INET=y 34 | CONFIG_IP_MULTICAST=y 35 | CONFIG_IP_PNP=y 36 | CONFIG_IP_PNP_DHCP=y 37 | CONFIG_IP_PNP_BOOTP=y 38 | CONFIG_IP_PNP_RARP=y 39 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 40 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set 41 | # CONFIG_INET_XFRM_MODE_BEET is not set 42 | # CONFIG_INET_DIAG is not set 43 | # CONFIG_INET6_XFRM_MODE_TRANSPORT is not set 44 | # CONFIG_INET6_XFRM_MODE_TUNNEL is not set 45 | # CONFIG_INET6_XFRM_MODE_BEET is not set 46 | CONFIG_IPV6_SIT_6RD=y 47 | CONFIG_CFG80211=y 48 | CONFIG_MAC80211=y 49 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 50 | CONFIG_DEVTMPFS=y 51 | CONFIG_DEVTMPFS_MOUNT=y 52 | # CONFIG_STANDALONE is not set 53 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set 54 | CONFIG_MTD=y 55 | CONFIG_MTD_CMDLINE_PARTS=y 56 | CONFIG_MTD_BLOCK=y 57 | CONFIG_MTD_DATAFLASH=y 58 | CONFIG_BLK_DEV_LOOP=y 59 | CONFIG_BLK_DEV_RAM=y 60 | CONFIG_BLK_DEV_RAM_COUNT=4 61 | CONFIG_BLK_DEV_RAM_SIZE=8192 62 | CONFIG_SRAM=y 63 | CONFIG_NETDEVICES=y 64 | # CONFIG_ETHERNET is not set 65 | # CONFIG_USB_NET_DRIVERS is not set 66 | # CONFIG_WLAN_VENDOR_ADMTEK is not set 67 | # CONFIG_ATH9K_BTCOEX_SUPPORT is not set 68 | CONFIG_ATH9K_HTC=y 69 | # CONFIG_WLAN_VENDOR_ATMEL is not set 70 | # CONFIG_WLAN_VENDOR_BROADCOM is not set 71 | # CONFIG_WLAN_VENDOR_CISCO is not set 72 | # CONFIG_WLAN_VENDOR_INTEL is not set 73 | # CONFIG_WLAN_VENDOR_INTERSIL is not set 74 | # CONFIG_WLAN_VENDOR_MARVELL is not set 75 | # CONFIG_WLAN_VENDOR_MEDIATEK is not set 76 | # CONFIG_WLAN_VENDOR_RALINK is not set 77 | # CONFIG_WLAN_VENDOR_REALTEK is not set 78 | # CONFIG_WLAN_VENDOR_RSI is not set 79 | # CONFIG_WLAN_VENDOR_ST is not set 80 | # CONFIG_WLAN_VENDOR_TI is not set 81 | # CONFIG_WLAN_VENDOR_ZYDAS is not set 82 | # CONFIG_WLAN_VENDOR_QUANTENNA is not set 83 | # CONFIG_INPUT_LEDS is not set 84 | # CONFIG_INPUT_KEYBOARD is not set 85 | # CONFIG_INPUT_MOUSE is not set 86 | # CONFIG_SERIO is not set 87 | CONFIG_VT_HW_CONSOLE_BINDING=y 88 | CONFIG_LEGACY_PTY_COUNT=4 89 | CONFIG_SERIAL_ATMEL=y 90 | CONFIG_SERIAL_ATMEL_CONSOLE=y 91 | CONFIG_HW_RANDOM=y 92 | CONFIG_SPI=y 93 | CONFIG_SPI_ATMEL=y 94 | # CONFIG_HWMON is not set 95 | # CONFIG_HID is not set 96 | # CONFIG_USB_HID is not set 97 | CONFIG_USB=y 98 | CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 99 | CONFIG_USB_OHCI_HCD=y 100 | CONFIG_DMADEVICES=y 101 | CONFIG_SYNC_FILE=y 102 | # CONFIG_IOMMU_SUPPORT is not set 103 | CONFIG_FANOTIFY=y 104 | CONFIG_TMPFS=y 105 | CONFIG_CONFIGFS_FS=y 106 | CONFIG_SQUASHFS=y 107 | # CONFIG_SQUASHFS_ZLIB is not set 108 | CONFIG_SQUASHFS_XZ=y 109 | # CONFIG_NETWORK_FILESYSTEMS is not set 110 | CONFIG_NLS_CODEPAGE_437=y 111 | CONFIG_NLS_CODEPAGE_850=y 112 | CONFIG_NLS_ISO8859_1=y 113 | CONFIG_NLS_UTF8=y 114 | CONFIG_STRIP_ASM_SYMS=y 115 | CONFIG_DEBUG_FS=y 116 | # CONFIG_SCHED_DEBUG is not set 117 | # CONFIG_DEBUG_BUGVERBOSE is not set 118 | # CONFIG_FTRACE is not set 119 | CONFIG_CRYPTO_ECB=y 120 | CONFIG_CRYPTO_CRC32C=y 121 | CONFIG_CRYPTO_DEFLATE=y 122 | CONFIG_CRYPTO_LZO=y 123 | CONFIG_CRYPTO_USER_API_HASH=m 124 | CONFIG_CRYPTO_USER_API_SKCIPHER=m 125 | # CONFIG_CRYPTO_HW is not set 126 | CONFIG_CRC_CCITT=y 127 | CONFIG_CRC16=y 128 | CONFIG_CRC_ITU_T=y 129 | CONFIG_CRC7=y 130 | # CONFIG_XZ_DEC_X86 is not set 131 | # CONFIG_XZ_DEC_POWERPC is not set 132 | # CONFIG_XZ_DEC_IA64 is not set 133 | # CONFIG_XZ_DEC_SPARC is not set 134 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/USB-Bogus-Pipe-warning-rate-limited.patch: -------------------------------------------------------------------------------- 1 | From f7f88913f40aa71026df6377123935ba0f2940eb Mon Sep 17 00:00:00 2001 2 | From: aaaaaaaaaff 3 | Date: Wed, 2 May 2018 04:25:23 +0000 4 | Subject: [PATCH] aaaaa 5 | 6 | messageeeeeee 7 | 8 | B 9 | B 10 | --- 11 | drivers/usb/core/urb.c | 2 +- 12 | 1 file changed, 1 insertion(+), 1 deletion(-) 13 | 14 | diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c 15 | index 9fdf137..60fa733 100644 16 | --- a/drivers/usb/core/urb.c 17 | +++ b/drivers/usb/core/urb.c 18 | @@ -467,7 +467,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) 19 | 20 | /* Check that the pipe's type matches the endpoint's type */ 21 | if (usb_urb_ep_type_check(urb)) 22 | - dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", 23 | + dev_warn_once(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", 24 | usb_pipetype(urb->pipe), pipetypes[xfertype]); 25 | 26 | /* Check against a simple/standard policy */ 27 | -- 28 | 2.17.0 29 | 30 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/clk-at91-PLL-recalc_rate-now-using-cached-MUL-and-DI.patch: -------------------------------------------------------------------------------- 1 | From 47ded631f3c787f00272d140dbb5ff1842e2716d Mon Sep 17 00:00:00 2001 2 | From: Marcin Ziemianowicz 3 | Date: Sun, 29 Apr 2018 14:04:37 -0400 4 | Subject: [PATCH V4] clk: at91: PLL recalc_rate() now using cached MUL and DIV values 5 | 6 | When a USB device is connected to the USB host port on the SAM9N12 then 7 | you get "-62" error which seems to indicate USB replies from the device 8 | are timing out. Based on a logic sniffer, I saw the USB bus was running 9 | at half speed. 10 | 11 | The PLL code uses cached MUL and DIV values which get set in set_rate() 12 | and applied in prepare(), but the recalc_rate() function instead 13 | queries the hardware instead of using these cached values. Therefore, 14 | if recalc_rate() is called between a set_rate() and prepare(), the 15 | wrong frequency is calculated and later the USB clock divider for the 16 | SAM9N12 SOC will be configured for an incorrect clock. 17 | 18 | In my case, the PLL hardware was set to 96 Mhz before the OHCI 19 | driver loads, and therefore the usb clock divider was being set 20 | to /2 even though the OHCI driver set the PLL to 48 Mhz. 21 | 22 | As an alternative explanation, I noticed this was fixed in the past by 23 | 87e2ed338f1b ("clk: at91: fix recalc_rate implementation of PLL 24 | driver") but the bug was later re-introduced by 1bdf02326b71 ("clk: 25 | at91: make use of syscon/regmap internally"). 26 | 27 | Fixes: 1bdf02326b71 ("clk: at91: make use of syscon/regmap internally) 28 | Cc: 29 | Signed-off-by: Marcin Ziemianowicz 30 | --- 31 | Thank you for bearing with me about this Boris. 32 | 33 | Changes since V3: 34 | Fix for double returns found by kbluild test robot 35 | > Comments by Boris Brezillon about email formatting issues 36 | Changes since V2: 37 | Removed all logging/debug messages I added 38 | > Comment by Boris Brezillon about my fix being wrong addressed 39 | Changes since V1: 40 | Added patch set cover letter 41 | Shortened lines which were over >80 characters long 42 | > Comment by Greg Kroah-Hartman about "from" field in email addressed 43 | > Comment by Alan Stern about redundant debug lines addressed 44 | 45 | drivers/clk/at91/clk-pll.c | 13 +------------ 46 | 1 file changed, 1 insertion(+), 12 deletions(-) 47 | 48 | diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c 49 | index 7d3223fc..72b6091e 100644 50 | --- a/drivers/clk/at91/clk-pll.c 51 | +++ b/drivers/clk/at91/clk-pll.c 52 | @@ -132,19 +132,8 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, 53 | unsigned long parent_rate) 54 | { 55 | struct clk_pll *pll = to_clk_pll(hw); 56 | - unsigned int pllr; 57 | - u16 mul; 58 | - u8 div; 59 | - 60 | - regmap_read(pll->regmap, PLL_REG(pll->id), &pllr); 61 | - 62 | - div = PLL_DIV(pllr); 63 | - mul = PLL_MUL(pllr, pll->layout); 64 | - 65 | - if (!div || !mul) 66 | - return 0; 67 | 68 | - return (parent_rate / div) * (mul + 1); 69 | + return (parent_rate / pll->div) * (pll->mul + 1); 70 | } 71 | 72 | static long clk_pll_get_best_div_mul(struct clk_pll *pll, unsigned long rate, 73 | -- 74 | 2.17.0 75 | 76 | -------------------------------------------------------------------------------- /AT91SAM9N12/configs/full/BrainyV2.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/full/BrainyV2.dtb -------------------------------------------------------------------------------- /AT91SAM9N12/configs/full/rootfs.squashfs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/full/rootfs.squashfs -------------------------------------------------------------------------------- /AT91SAM9N12/configs/full/zImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/full/zImage -------------------------------------------------------------------------------- /AT91SAM9N12/configs/minimal/BrainyV2.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/minimal/BrainyV2.dtb -------------------------------------------------------------------------------- /AT91SAM9N12/configs/minimal/rootfs.squashfs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/minimal/rootfs.squashfs -------------------------------------------------------------------------------- /AT91SAM9N12/configs/minimal/zImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/configs/minimal/zImage -------------------------------------------------------------------------------- /AT91SAM9N12/hardware/Documentation_Final.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/hardware/Documentation_Final.PDF -------------------------------------------------------------------------------- /AT91SAM9N12/hardware/SPI_Breakout.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/hardware/SPI_Breakout.PDF -------------------------------------------------------------------------------- /AT91SAM9N12/hardware/SPI_ConnectionPDF.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/hardware/SPI_ConnectionPDF.PDF -------------------------------------------------------------------------------- /AT91SAM9N12/hardware/Support_Board.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/hardware/Support_Board.PDF -------------------------------------------------------------------------------- /AT91SAM9N12/images/AT91Bootstrap_CMDArgs.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/AT91Bootstrap_CMDArgs.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/AT91Bootstrap_Flash.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/AT91Bootstrap_Flash.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/AT91Bootstrap_menuconfig.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/AT91Bootstrap_menuconfig.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/BGA_Pad_Issue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/BGA_Pad_Issue.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/BrainyV3_Back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/BrainyV3_Back.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/BrainyV3_Front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/BrainyV3_Front.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/Buildroot_Example.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Buildroot_Example.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/Buildroot_Kernel_Module.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Buildroot_Kernel_Module.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/DSC_9624_S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/DSC_9624_S.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/DSC_9625_S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/DSC_9625_S.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/DSC_9626_S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/DSC_9626_S.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/DSC_9629_S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/DSC_9629_S.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/Enumerate_Fail_packet.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Enumerate_Fail_packet.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/Enumerate_Fail_packet_Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Enumerate_Fail_packet_Small.png -------------------------------------------------------------------------------- /AT91SAM9N12/images/Enumerate_Fail_singlebit.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Enumerate_Fail_singlebit.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/Enumerate_Fail_singlebit_Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Enumerate_Fail_singlebit_Small.png -------------------------------------------------------------------------------- /AT91SAM9N12/images/IMG_20180321_031355.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/IMG_20180321_031355.jpg -------------------------------------------------------------------------------- /AT91SAM9N12/images/Linux_ath9k_search.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/Linux_ath9k_search.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/RK3399_Taobao.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/RK3399_Taobao.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/RootFS_Size0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/RootFS_Size0.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/SAM-BA_DRAM.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/SAM-BA_DRAM.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/images/SAM-BA_Dataflash.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/AT91SAM9N12/images/SAM-BA_Dataflash.PNG -------------------------------------------------------------------------------- /AT91SAM9N12/readme.md: -------------------------------------------------------------------------------- 1 | # Atmel SAM9N12 Embedded Linux System 2 | 3 | ![Front](images/DSC_9624_S.jpg) 4 | 5 | ## Description 6 | 7 | The SAM9N12 is a low cost MPU from Atmel (now Microchip) that is capable of running linux. It's based on a 400 MHz ARM926EJ-S core from ARM (very old, a far cry from what you can get in even the cheapest of phones or tablets) and has a 32 bit EBI (External Bus Interface) to work with both SDRAM and NAND Flash at the same time. It can also use SPI based FLASH and USB OTG letting you use a USB Flash drive as another data store. 8 | 9 | This board has: 10 | 11 | * 64 MB of DDR2-SDRAM (W9751G6KB-25-ND) 12 | * 4 MB of Dataflash (AT45DB321E-SHF-B) 13 | * USB OTG and USB Device broken out (both only up to 12 Mbps Full Speed) 14 | 15 | Originally this project was done years ago relying on Atmel forked branches of U-Boot and the Linux kernel from Atmel. While this did work, it meant having to use old non mainlined versions of each project. Later this project was restarted with the intention of using mainline sources for everything and BuildRoot to streamline the linux and root filesystem generation. The old version of this documentation, dubbed "Old School", can be found [here](OldSchool.md), and shows how to do everything **manually**. This includes compiling the Linux kernel by hand to generate a zImage, creating a minimal root file system, and even using flash drive for the root file system including a native GCC toolchain! 16 | 17 | This documentation will show the process of bringing a board like this up from start to finish, including describing the intended boot flow, how to configure all the software (AT91 Bootstrap, Kernel, root file system, BuildRoot, etc), show various bugs and issues found in the process (USB OTG was a fun one), how much space various functionality uses, and how to build a semi useful root file system (networking, stress, htop, tmux, etc). 18 | 19 | The end goal is to have a system that can do the following: 20 | 21 | - Boot to a shell and be able to communicate with it over serial 22 | - Networking support 23 | - Use the [RNX-N150HG](https://wikidevi.com/wiki/Rosewill_RNX-N150HG) USB WiFi dongle to talk to the outside world 24 | - Read only file system with compression (SquashFS) 25 | - Run various tools (htop, stress, tmux, ping) 26 | - If possible, an ssh server and [TCC](https://www.wikiwand.com/en/Tiny_C_Compiler) to compile a small C based demo program 27 | 28 | ## Status 29 | 30 | Everything seems to work except NAND flash, likely due to soldering issues with the SAM9N12 BGA based package. Because NAND flash isn't working, it was decided to try and stick everything in the 32 Megabit Data flash (yep, only 4 Megabytes for a boot loader, kernel, and root file system). USB OTG is used for a Wifi dongle so we get networking support to make this more interesting. 31 | 32 | ## Boot Flow 33 | 34 | The AT91SAM9N12 has a boot loader in ROM which can boot from NAND Flash, SPI Flash, SPI Data flash, and can even boot directly into the Linux kernel (therefore not needing U-Boot). There has been some reverse engineering work done on the boot loader [here](http://hobbygenius.co.uk/blog/1622). 35 | 36 | The memory setup we will be using is as follows: 37 | 38 | AT45DB321E-SHF-B 32 Mbit -> 4,325,376 Byte or 0x__42_0000 (8192 Pages * 528 Bytes) 39 | W9751G6KB-25-ND 512 MBit -> 67,108,864 Byte or 0x_400_0000 40 | 41 | Flash Item DRAM 42 | 0x000000 AT91 bootstrap -> Not Copied 43 | 0x002800 Device Tree -> 0x2100_0000 44 | 0x007300 zImage -> 0x2200_0000 45 | 0x1E0000 RootFS -> Not Copied 46 | 0x417C00 Non Volatile -> Not Copied/Used 47 | 48 | As a rough overview to show in the grand scheme of things how this will look: 49 | 50 | 1. The boot loader will first look for any boot-able data in SPI Flash, SPI Data flash, and NAND Flash. In our case, we have the AT91 BootStrap in Dataflash at an offset of zero (start of Data flash). 51 | 2. The [AT91 Bootstrap](http://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap) will initialize DRAM and then copy data from Data flash (in our case the Kernel at an offset of ```0x7300```) into DRAM (at ```0x2200_0000```), and the Device Tree from Dataflash at an offset of ```0x4B00``` to DRAM at ```0x2100_0000```. 52 | 3. Then the boot loader will initialize the environment for the Linux kernel (address of device tree in a register, etc) and pass execution to the kernel. 53 | 4. Since the kernel is a zImage (self extracting kernel image), the kernel will uncompress itself, execute itself, read the device tree which was copied to RAM earlier, initialize various drivers based on the device tree entries, and lastly pass execution to whatever is relevant in the root file system. 54 | 55 | ## First boot 56 | 57 | First things first, let's get the board powered up with the Dataflash erased. Upon bootup the boot loader in ROM of the SAM9N12 will configure basic clocking and the ```DBGU``` serial port on pins ```R5``` and ```R6``` to run at 115200 baud and output the text ```RomBOOT```. If you see this then it means a lot went right, such as power integrity, clocking, BGA packages soldered correctly, and of course no magic smoke means no shorts. [Next](SAMBA.md) we will look into getting setting up SAMBA so we can flash the AT91 Bootstrap to data flash. 58 | -------------------------------------------------------------------------------- /AT91SAM9N12/replicate.md: -------------------------------------------------------------------------------- 1 | # Replicating 2 | 3 | To replicate the build this writeup uses, including the specific version of the kernel (4.15.18) and patches for the USB device, here are various files you need. The output size may change slightly due to the GCC toolchain being used by buildroot changing, since it's only specified to use GCC 7.X instead of a specific GCC. Packages such as htop and whatnot are also not locked to a version, so they too may change in size as time goes on. 4 | 5 | It is assumed the base directory for this is ```/home/hak8or```. If this should be modified, then make sure to adjust the absolute paths in the various ```defconfig``` files. There are two versions of the system. 6 | 7 | - A "minimal" system which boots into a shell with Musl as the c standard library, recognizes the USB WiFi dongle, and applies patches to the kernel for having the dongle work. Additionally it has wpa_supplicant and the dongle firmware installed so a network connection can be setup. 8 | 9 | - A "full" version which is on top of the "minimal" version while including packages like htop, curl, tmux, and others. Root user has a password of "pass" which lets people ssh in as the root user. 10 | 11 | Both of these versions sit under their own "minimal" or "full" folder. This replication guide will assume the "minimal" version. 12 | 13 | ## AT91 Bootstrap 14 | 15 | To build bootstrap, here is an abbreviated version of what was written in the guide. 16 | 17 | ```bash 18 | # Get at91 bootstrap 19 | git clone https://github.com/linux4sam/at91bootstrap.git 20 | 21 | # Enter the cloned repo 22 | cd at91bootstrap 23 | 24 | # Get the defconfig. Sadly make BrainyV2_AT91Bootstrap_defconfig doesn't work, so we 25 | # have save it as a .config file. 26 | wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/BrainyV2_AT91Bootstrap_defconfig -o .config 27 | 28 | # Ensure we have a toolchain installed 29 | yaourt -S arm-none-eabi-gcc 30 | 31 | # Say there are only 4 banks in the DRAM IC we are using instead of 8. 32 | sed -i 's/AT91C_DDRC2_NB_BANKS_8/AT91C_DDRC2_NB_BANKS_4/g' board/at91sam9n12ek/at91sam9n12ek.c 33 | 34 | # Build bootstrap, flash-able bin is in binaries/boot.bin 35 | make CROSS_COMPILE=arm-none-eabi- 36 | ``` 37 | 38 | You can also just download the binary itself via ```wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/BrainyV2_AT91Bootstrap.bin```. 39 | 40 | ## Buildroot + Linux 41 | 42 | First we get all the dependencies. 43 | 44 | ```bash 45 | # Get buildroot 46 | wget https://buildroot.org/downloads/buildroot-2018.02.1.tar.gz 47 | tar -xzf buildroot-2018.02.1.tar.gz 48 | 49 | # Get the buildroot configuration file for the minimal system. To get the full system, just use BrainyV2_buildroot_full_defconfig instead. 50 | wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/BrainyV2_buildroot_minimal_defconfig 51 | 52 | # Get the linux configuration file 53 | wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/BrainyV2_kernel_defconfig 54 | 55 | # Get the device tree 56 | wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/BrainyV2.dts 57 | 58 | # Get the patch for USB clock being wrong. 59 | wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/clk-at91-PLL-recalc_rate-now-using-cached-MUL-and-DI.patch 60 | 61 | # Get the patch for USB bogus pipe error. 62 | wget https://brainyv2.hak8or.com/AT91SAM9N12/configs/USB-Bogus-Pipe-warning-rate-limited.patch 63 | ``` 64 | 65 | Then to build this, a simple ```make``` in the buildroot folder should suffice. The buildroot defconfig should pull in the device tree, apply the USB clock patch, and compile the kernel with the custom defconfig. The output should be in ```output/images```. If you have issues, ensure the paths in the various ```defconfig```'s is accurate. 66 | 67 | ```bash 68 | # Enter buildroot dir 69 | cd buildroot-2018.02.1 70 | 71 | # Copy over the defconfig 72 | make defconfig BR2_DEFCONFIG=/home/hak8or/BrainyV2_buildroot_minimal_defconfig 73 | 74 | # Build our system! 75 | make 76 | ``` 77 | 78 | ### Output size 79 | 80 | ```bash 81 | [hak8or@CT108 buildroot-minimal]$ ls -la --block-size=k output/images/ 82 | total 3234K 83 | drwxr-xr-x 2 hak8or hak8or 1K May 3 04:58 . 84 | drwxr-xr-x 6 hak8or hak8or 1K May 3 04:39 .. 85 | -rw-r--r-- 1 hak8or hak8or 18K May 3 04:58 BrainyV2.dtb 86 | -rw-r--r-- 1 hak8or hak8or 1408K May 3 05:14 rootfs.squashfs 87 | -rw-r--r-- 1 hak8or hak8or 1749K May 3 04:58 zImage 88 | 89 | [hak8or@CT108 buildroot-minimal]$ cd ../buildroot_full 90 | 91 | [hak8or@CT108 buildroot_full]$ ls -la --block-size=k output/images/ 92 | total 4015K 93 | drwxr-xr-x 2 hak8or hak8or 1K May 3 18:52 . 94 | drwxr-xr-x 6 hak8or hak8or 1K May 3 18:16 .. 95 | -rw-r--r-- 1 hak8or hak8or 18K May 3 18:51 BrainyV2.dtb 96 | -rw-r--r-- 1 hak8or hak8or 2200K May 3 18:52 rootfs.squashfs 97 | -rw-r--r-- 1 hak8or hak8or 1749K May 3 18:51 zImage 98 | ``` 99 | 100 | You can also find the binaries in the ```configs/full``` or ```configs/minimal``` folders, with each folder including the bootloader, the device tree binary, the kernel zImage, and the root file system. 101 | 102 | ### New defconfig 103 | 104 | Most packages in buildroot, including buildroot itself, have the ability to save their menuconfig state via a ```make {pkg_name}_savedefconfig``` command. Buildroot itself is a bit diffirent, for example doing ```make savedefconfig``` doesn't seem to create a defconfig file anywhere. Instead, doing ```make savedefconfig BR2_DEFCONFIG=defconfig``` creates a defconfig file at the root of the buildroot directory. 105 | 106 | On the other hand, saving the Linux configuration can be done by ```make linux-savedefconfig``` with the file created in ```output/build/linux-4.15.18/defconfig```. 107 | -------------------------------------------------------------------------------- /DSC_9296.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/DSC_9296.jpg -------------------------------------------------------------------------------- /MX233/gists/BCB-to-SD-card-with-image.sh: -------------------------------------------------------------------------------- 1 | echo "Clear the SD card partition first" 2 | dd if=/dev/zero of=/dev/sdb1 3 | 4 | echo "And now we write it to the SD card." 5 | dd if=bootstream-factory.raw of=/dev/sdb1 6 | 7 | echo "Sync things up to make sure we are right" 8 | sync 9 | 10 | echo "Dumping the image to check if things went back" 11 | mkdir verification_dumps 12 | cd verification_dumps 13 | rm part1_dump 14 | rm part3_dump 15 | dd if=/dev/sdb1 of=part1_dump 16 | dd if=/dev/sdb3 of=part3_dump 17 | sync 18 | 19 | # echo "=============Contents of BCD=============" 20 | hd part3_dump 21 | 22 | echo "Done, take out the card" 23 | -------------------------------------------------------------------------------- /MX233/gists/BCB-to-SD-card.sh: -------------------------------------------------------------------------------- 1 | echo "Remove old files" 2 | rm bcb 3 | rm bcb_512.cfg 4 | rm bcb_sdcard_part.old 5 | rm bcb_sdcard_part.readback 6 | 7 | echo "Compiling bcb tool" 8 | gcc bcb.c -o bcb 9 | 10 | echo "Running bcb tool" 11 | ./bcb 12 | 13 | echo "Saving old partition contents to bcb_sdcard_part.old" 14 | dd if=/dev/sdb3 of=bcb_sdcard_part.old 15 | 16 | echo "============= Contents of ->OLD<- BCD =============" 17 | hd bcb_sdcard_part.old 18 | 19 | echo "Clear the SD card boot block partition first" 20 | dd if=/dev/zero of=/dev/sdb3 21 | sync 22 | 23 | echo "Write the BCD to the sd card BCD parition" 24 | dd if=bcb_512.cfg of=/dev/sdb3 25 | sync 26 | 27 | echo "Reading back BCD partition for verification" 28 | dd if=/dev/sdb3 of=bcb_sdcard_part.readback 29 | 30 | echo "============= Contents of ->NEW<- BCD =============" 31 | hd bcb_sdcard_part.readback 32 | 33 | sync 34 | echo "Done, remove card" 35 | -------------------------------------------------------------------------------- /MX233/gists/OSH-4-layer-renaming.sh: -------------------------------------------------------------------------------- 1 | proj_name=Lumy 2 | 3 | # Do the renames of mid layers 4 | mv $proj_name.G1 $proj_name.G2L 5 | mv $proj_name.G2 $proj_name.G3L 6 | 7 | # Rename outline layer 8 | mv $proj_name.GM3 $proj_name.GKO 9 | 10 | zip $proj_name.zip $proj_name.* 11 | 12 | echo "All gerbers zipped in $proj_name.zip" 13 | echo "Title: Brainy v2" 14 | echo "Description: ARM MPU with DDR2 mem and NAND flash for Linux, V2 with bigger pads" -------------------------------------------------------------------------------- /MX233/gists/UART-recovery-mode-log.txt: -------------------------------------------------------------------------------- 1 | pitc_loader(8002) 2 | 3 | loading pitc id 8002 4 | pitc installed 5 | initialize pitc 2864: id:8002 6 | pitc 8002: process_cdb(cdb:13) 7 | k_pitc_cmd_read_otp_register 8 | 9 | u32TotalBytesToSend: 4 10 | pitc_wait_for_data_in: call to state success 11 | data-out stage complete 12 | pitc 8002: process_cdb(cdb:13) 13 | k_pitc_cmd_read_otp_register 14 | 15 | u32TotalBytesToSend: 4 16 | pitc_wait_for_data_in: call to state success 17 | data-out stage complete 18 | pitc 8002: process_cdb(cdb:12) 19 | k_pitc_cmd_inquiry 20 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 21 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 22 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 0 23 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 24 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 25 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 0 26 | register address: 0x8002c020 27 | lock bit: 0x0 28 | bank: 0x0 29 | word: 0x0 30 | locked: 0x0 31 | shadowed: 0x0 32 | pitc 8002: process_cdb(cdb:10) 33 | k_pitc_cmd_test_unit_ready 34 | pitc 8002: process_cdb(cdb:12) 35 | k_pitc_cmd_inquiry 36 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 37 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 1 38 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 0 39 | PITC_INQUIRY_INFOPAGE__INFO 40 | 41 | PITC_INQUIRY - PITC ID 0x8002 42 | pitc 0x8002: uninstall pitc 43 | 44 | pitc_loader(8002) 45 | 46 | loading pitc id 8002 47 | pitc installed 48 | initialize pitc 2864: id:8002 49 | pitc 8002: process_cdb(cdb:13) 50 | k_pitc_cmd_read_otp_register 51 | 52 | u32TotalBytesToSend: 4 53 | pitc_wait_for_data_in: call to state success 54 | data-out stage complete 55 | pitc 8002: process_cdb(cdb:13) 56 | k_pitc_cmd_read_otp_register 57 | 58 | u32TotalBytesToSend: 4 59 | pitc_wait_for_data_in: call to state success 60 | data-out stage complete 61 | pitc 8002: process_cdb(cdb:12) 62 | k_pitc_cmd_inquiry 63 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 64 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 65 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 24 66 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 67 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 68 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 24 69 | register address: 0x8002c1a0 70 | lock bit: 0x18 71 | bank: 0x3 72 | word: 0x0 73 | locked: 0x0 74 | shadowed: 0x0 75 | pitc 8002: process_cdb(cdb:14) 76 | k_pitc_cmd_write_otp_register 77 | pitc_wait_for_data_out: call to state 78 | pitc_wait_for_data_out: call to state success 79 | data-in stage complete 80 | pitc 8002: process_cdb(cdb:13) 81 | k_pitc_cmd_read_otp_register 82 | 83 | u32TotalBytesToSend: 4 84 | pitc_wait_for_data_in: call to state success 85 | data-out stage complete 86 | pitc 8002: process_cdb(cdb:13) 87 | k_pitc_cmd_read_otp_register 88 | 89 | u32TotalBytesToSend: 4 90 | pitc_wait_for_data_in: call to state success 91 | data-out stage complete 92 | pitc 8002: process_cdb(cdb:12) 93 | k_pitc_cmd_inquiry 94 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 95 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 96 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 16 97 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 98 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 99 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 16 100 | register address: 0x8002c120 101 | lock bit: 0x0 102 | bank: 0x2 103 | word: 0x0 104 | locked: 0x0 105 | shadowed: 0x1 106 | pitc 8002: process_cdb(cdb:13) 107 | k_pitc_cmd_read_otp_register 108 | 109 | u32TotalBytesToSend: 4 110 | pitc_wait_for_data_in: call to state success 111 | data-out stage complete 112 | pitc 8002: process_cdb(cdb:12) 113 | k_pitc_cmd_inquiry 114 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 115 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 116 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 24 117 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 118 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 119 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 24 120 | register address: 0x8002c1a0 121 | lock bit: 0x18 122 | bank: 0x3 123 | word: 0x0 124 | locked: 0x0 125 | shadowed: 0x0 126 | pitc 8002: process_cdb(cdb:10) 127 | k_pitc_cmd_test_unit_ready 128 | pitc 8002: process_cdb(cdb:12) 129 | k_pitc_cmd_inquiry 130 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 131 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 1 132 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 0 133 | PITC_INQUIRY_INFOPAGE__INFO 134 | 135 | PITC_INQUIRY - PITC ID 0x8002 136 | pitc 0x8002: uninstall pitc 137 | 138 | pitc_loader(8002) 139 | 140 | loading pitc id 8002 141 | pitc installed 142 | initialize pitc 2864: id:8002 143 | pitc 8002: process_cdb(cdb:13) 144 | k_pitc_cmd_read_otp_register 145 | 146 | u32TotalBytesToSend: 4 147 | pitc_wait_for_data_in: call to state success 148 | data-out stage complete 149 | pitc 8002: process_cdb(cdb:13) 150 | k_pitc_cmd_read_otp_register 151 | 152 | u32TotalBytesToSend: 4 153 | pitc_wait_for_data_in: call to state success 154 | data-out stage complete 155 | pitc 8002: process_cdb(cdb:12) 156 | k_pitc_cmd_inquiry 157 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 158 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 159 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 25 160 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 161 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 162 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 25 163 | register address: 0x8002c1b0 164 | lock bit: 0x19 165 | bank: 0x3 166 | word: 0x1 167 | locked: 0x0 168 | shadowed: 0x0 169 | pitc 8002: process_cdb(cdb:13) 170 | k_pitc_cmd_read_otp_register 171 | 172 | u32TotalBytesToSend: 4 173 | pitc_wait_for_data_in: call to state success 174 | data-out stage complete 175 | pitc 8002: process_cdb(cdb:12) 176 | k_pitc_cmd_inquiry 177 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 178 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 179 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 24 180 | PITC_INQUIRY_INFOPAGE__INFO u8Opcode: 18 181 | PITC_INQUIRY_INFOPAGE__INFO u8InfoPage: 3 182 | PITC_INQUIRY_INFOPAGE__INFO u32InfoParam: 24 183 | register address: 0x8002c1a0 184 | lock bit: 0x18 185 | bank: 0x3 186 | word: 0x0 187 | locked: 0x0 188 | shadowed: 0x0 189 | ▒▒▒▒▒ !@▒f▒▒▒▒▒▒▒`▒▒▒ -------------------------------------------------------------------------------- /MX233/gists/gen-a-BCB.cpp: -------------------------------------------------------------------------------- 1 | // This file will create the 512 byte BCB config block that must be located 2 | // at the last block of the SD card when booting from SD with BCB. 3 | // This is for STMP378x or i.MX233 BCB boot creation. 4 | // You can use dd in Linux to wriet this one out to the SD card. 5 | 6 | #include 7 | 8 | // NEVER CHANGE ANY OF THE FOLLOWING: 9 | #define CONFIG_BLOCK_SIGNATURE 0x00112233 // This MUST be bcb_config[0] 10 | #define CONFIG_BLOCK_VERSION 0x1 // This must be bcb_config[1] 11 | #define BOOTIMAGE_TAG 0x50 // This is the boot image tag ROM looks 12 | // to decide where to start booting. 13 | #define NUM_DRIVES 0x4 // not really used by the ROM. 14 | 15 | // The following defines may need to be changed. 16 | 17 | // Image Start Block 18 | // Change this number to the starting sector of the boot image. 19 | #define IMAGE_START_BLOCK 2048 // 2048th sector 20 | 21 | FILE *f1; 22 | 23 | void main(void) 24 | { 25 | unsigned int i, dat = CONFIG_BLOCK_SIGNATURE, NUM_WORDS_WRITTEN; 26 | f1 = fopen ("bcb_512.cfg", "wt"); 27 | 28 | fwrite(&dat, sizeof(dat), 1, f1); // 1st byte is signature. 29 | 30 | dat = CONFIG_BLOCK_VERSION; 31 | fwrite(&dat, sizeof(dat), 1, f1); // 2nd byte is version. 32 | 33 | dat = NUM_DRIVES; 34 | fwrite(&dat, sizeof(dat), 1, f1); 35 | 36 | // Go ahead and write another couple dummy words, ROM won't use anyways... 37 | fwrite(&dat, sizeof(dat), 1, f1); 38 | fwrite(&dat, sizeof(dat), 1, f1); 39 | 40 | // Now write the sector where the actual boot image will be. 41 | dat = IMAGE_START_BLOCK; 42 | fwrite(&dat, sizeof(dat), 1, f1); 43 | 44 | // Now we can write the boot tag ROM will be looking for. 45 | dat = BOOTIMAGE_TAG; 46 | fwrite(&dat, sizeof(dat), 1, f1); 47 | fwrite(&dat, sizeof(dat), 1, f1); 48 | fwrite(&dat, sizeof(dat), 1, f1); 49 | fwrite(&dat, sizeof(dat), 1, f1); 50 | 51 | dat = 0xDEADBEEF; 52 | fwrite(&dat, sizeof(dat), 1, f1); 53 | 54 | NUM_WORDS_WRITTEN = 11; // number of times called fwrite. 55 | 56 | // Need to make the .cfg file 512 bytes long, so... 57 | for(i=0; i < ((512/4) - NUM_WORDS_WRITTEN); i++){ 58 | fwrite(&i, sizeof(i), 1, f1); 59 | } 60 | 61 | fclose (f1); 62 | } 63 | 64 | /* 65 | Contents of BCD written to SD card in the last partition/sector. 66 | 00000000 33 22 11 00 01 00 00 00 04 00 00 00 04 00 00 00 |3"..............| 67 | 00000010 04 00 00 00 00 08 00 00 50 00 00 00 50 00 00 00 |........P...P...| 68 | 00000020 50 00 00 00 50 00 00 00 ef be ad de 00 00 00 00 |P...P...........| 69 | 00000030 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 |................| 70 | 00000040 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 |................| 71 | 00000050 09 00 00 00 0a 00 00 00 0b 00 00 00 0c 00 00 00 |................| 72 | 00000060 0d 00 00 00 0e 00 00 00 0f 00 00 00 10 00 00 00 |................| 73 | 00000070 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 |................| 74 | 00000080 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 |................| 75 | 00000090 19 00 00 00 1a 00 00 00 1b 00 00 00 1c 00 00 00 |................| 76 | 000000a0 1d 00 00 00 1e 00 00 00 1f 00 00 00 20 00 00 00 |............ ...| 77 | 000000b0 21 00 00 00 22 00 00 00 23 00 00 00 24 00 00 00 |!..."...#...$...| 78 | 000000c0 25 00 00 00 26 00 00 00 27 00 00 00 28 00 00 00 |%...&...'...(...| 79 | 000000d0 29 00 00 00 2a 00 00 00 2b 00 00 00 2c 00 00 00 |)...*...+...,...| 80 | 000000e0 2d 00 00 00 2e 00 00 00 2f 00 00 00 30 00 00 00 |-......./...0...| 81 | 000000f0 31 00 00 00 32 00 00 00 33 00 00 00 34 00 00 00 |1...2...3...4...| 82 | 00000100 35 00 00 00 36 00 00 00 37 00 00 00 38 00 00 00 |5...6...7...8...| 83 | 00000110 39 00 00 00 3a 00 00 00 3b 00 00 00 3c 00 00 00 |9...:...;...<...| 84 | 00000120 3d 00 00 00 3e 00 00 00 3f 00 00 00 40 00 00 00 |=...>...?...@...| 85 | 00000130 41 00 00 00 42 00 00 00 43 00 00 00 44 00 00 00 |A...B...C...D...| 86 | 00000140 45 00 00 00 46 00 00 00 47 00 00 00 48 00 00 00 |E...F...G...H...| 87 | 00000150 49 00 00 00 4a 00 00 00 4b 00 00 00 4c 00 00 00 |I...J...K...L...| 88 | 00000160 4d 00 00 00 4e 00 00 00 4f 00 00 00 50 00 00 00 |M...N...O...P...| 89 | 00000170 51 00 00 00 52 00 00 00 53 00 00 00 54 00 00 00 |Q...R...S...T...| 90 | 00000180 55 00 00 00 56 00 00 00 57 00 00 00 58 00 00 00 |U...V...W...X...| 91 | 00000190 59 00 00 00 5a 00 00 00 5b 00 00 00 5c 00 00 00 |Y...Z...[...\...| 92 | 000001a0 5d 00 00 00 5e 00 00 00 5f 00 00 00 60 00 00 00 |]...^..._...`...| 93 | 000001b0 61 00 00 00 62 00 00 00 63 00 00 00 64 00 00 00 |a...b...c...d...| 94 | 000001c0 65 00 00 00 66 00 00 00 67 00 00 00 68 00 00 00 |e...f...g...h...| 95 | 000001d0 69 00 00 00 6a 00 00 00 6b 00 00 00 6c 00 00 00 |i...j...k...l...| 96 | 000001e0 6d 00 00 00 6e 00 00 00 6f 00 00 00 70 00 00 00 |m...n...o...p...| 97 | 000001f0 71 00 00 00 72 00 00 00 73 00 00 00 74 00 00 00 |q...r...s...t...| 98 | */ 99 | -------------------------------------------------------------------------------- /MX233/gists/initial-4-layer-redo-boot-log.txt: -------------------------------------------------------------------------------- 1 | 2 | r14_unHTLCLC 3 | Undefined Instruction 4 | r14_unHTLCHTLCHTLCLC 5 | Undefined Instruction 6 | r14_unHTLCLC 7 | Undefined Instruction 8 | r14_unHTLCHTLCHTLCLC 9 | Undefined Instruction 10 | r14_unHTLCLC 11 | Undefined Instruction 12 | r14_unHTLCLC 13 | Undefined Instruction 14 | r14_unHTLCLC 15 | Undefined Instruction 16 | r14_unHTLCHTLCHTLCHTLCHTLCLC 17 | Undefined Instruction 18 | r14_unHTLCLC 19 | Data Abort 20 | r14_HTLCHTLCHTLCLC 21 | Data Abort 22 | r14_HTLCLC 23 | Undefined Instruction 24 | r14_unHTLCLC 25 | Undefined Instruction 26 | r14_unHTLCLC▒▒ 27 | Undefined Instruction 28 | r14_unHTLCHTLCLC 29 | Undefined Instruction 30 | r14_unHTLCLC 31 | SWI 32 | 33 | r14_HTLCLC 34 | Undefined Instruction 35 | r14_unHTLCHTLCLC 36 | Undefined Instruction 37 | r14_unHTLC0x8020a014 38 | ▒▒▒▒▒▒ɲHHTLCLC 39 | Undefined Instruction 40 | r14_unHTLCLC 41 | Undefined Instruction 42 | r14_unHTLCHTLCHTLCHTLCHTLCHTLCHTLCHTLCHTLCHTLCHTLCLC 43 | Undefined Instruction 44 | r14_unHTLCHTLCLC 45 | Undefined Instruction 46 | r14_unHTLCLC 47 | Undefined Instruction 48 | r14_unHTLCLC 49 | Undefined Instruction 50 | r14_unHTLCHTLCLC 51 | Undefined Instruction 52 | r14_unHTLCHTLCHTLCLC 53 | Undefined Instruction 54 | r14_unHTLCHTLCHTLC 55 | PowerPrep start initialize power... 56 | Battery Voltage = 0.72V 57 | No battery or bad battery detected!!!.Disa bling battery voltage measurements./r/nJul 29 201008:42:31 58 | EMI_CTRL 0x1C084040 59 | FRAC 0x92926192 60 | init_ddr_mt46v32m16_133Mhz 61 | power 0x00820710 62 | Frac 0x92926192 63 | start change cpu freq 64 | hbus 0x00000003 65 | cpu 0x00010001 66 | 67 | Data Abort 68 | r14_ 69 | PowerPrep start initialize power... 70 | Battery Voltage = 1.63V 71 | No battery or bad battery detected!!!.Disa bling battery voltage ▒ 72 | PowerPrep start initialize power... 73 | Battery Voltage = 1.63V 74 | No battery or bad battery detected!!!.Disa bling battery voltage measurements./r/nJul 29 201008:42:31 75 | EMI_CTRL 0x1C084040 76 | FRAC 0x92926192 77 | init_ddr_mt46v32m16_133Mhz 78 | power 0x00820710 79 | Frac 0x92926192 80 | start change cpu freq 81 | hbus 0x00000003 82 | cpu 0x00010001 83 | 84 | Data Abort 85 | r14_ 86 | PowerPrep start initialize power... 87 | Battery Voltage = 1.63V 88 | No battery or bad battery detected!!!.Disa bling battery voltage measurements./r/nJul 29 201008:42:31 89 | EMI_CTRL 0x1C084040 90 | FRAC 0x92926192 91 | init_ddr_mt46v32m16_133Mhz 92 | power 0x00820710 93 | Frac 0x92926192 94 | start change cpu freq 95 | hbus 0x00000003 96 | cpu 0x00010001 97 | 98 | Data Abort 99 | r14_ 100 | PowerPrep start initialize power... 101 | Battery Voltage = 1.63V 102 | No battery or bad battery detected!!!.Disa bling battery voltage measurements./r/nJul 29 201008:42:31 103 | EMI_CTRL 0x1C084040 104 | FRAC 0x92926192 105 | init_ddr_mt46v32m16_133Mhz 106 | power 0x00820710 107 | Frac 0x92926192 108 | start change cpu freq 109 | hbus 0x00000003 110 | cpu 0x00010001 111 | ▒ 112 | PowerPrep start initialize power... 113 | Battery Voltage = 0.71V 114 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 115 | EMI_CTRL 0x1C084040 116 | FRAC 0x92926192 117 | init_ddr_mt46v32m16_133Mhz 118 | power 0x00820710 119 | Frac 0x92926192 120 | start change cpu freq 121 | hbus 0x00000003 122 | cpu 0x00010001 123 | 124 | Data Abort 125 | r14_ 126 | PowerPrep start initialize power... 127 | Battery Voltage = 1.63V 128 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 129 | EMI_CTRL 0x1C084040 130 | FRAC 0x92926192 131 | init_ddr_mt46v32m16_133Mhz 132 | power 0x00820710 133 | Frac 0x92926192 134 | start change cpu freq 135 | hbus 0x00000003 136 | cpu 0x00010001 137 | 138 | Data Abort 139 | r14_ 140 | PowerPrep start initialize power... 141 | Battery Voltage = 1.62V 142 | No battery or bad battery detected!!!.Disabling battery voltage ▒ 143 | PowerPrep start initialize power... 144 | Battery Voltage = 1.63V 145 | No battery or bad battery detected!!!.Disabling battery voltage ▒ 146 | PowerPrep start initialize power... 147 | Battery Voltage = 1.63V 148 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 149 | EMI_CTRL 0x1C084040 150 | FRAC 0x92926192 151 | init_ddr_mt46v32m16_133Mhz 152 | power 0x00820710 153 | Frac 0x92926192 154 | start change cpu freq 155 | hbus 0x00000003 156 | cpu 0x00010001 157 | 158 | Data Abort 159 | r14_ 160 | PowerPrep start initialize power... 161 | Battery Voltage = 1.62V 162 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 163 | EMI_CTRL 0x1C084040 164 | FRAC 0x92926192 165 | init_ddr_mt46v32m16_133Mhz 166 | power 0x00820710 167 | Frac 0x92926192 168 | start change cpu freq 169 | hbus 0x00000003 170 | cpu 0x00010001 171 | ▒ 172 | PowerPrep start initialize power... 173 | Battery Voltage = 0.84V 174 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 175 | EMI_CTRL 0x1C084040 176 | FRAC 0x92926192 177 | init_ddr_mt46v32m16_133Mhz 178 | power 0x00820710 179 | Frac 0x92926192 180 | start change cpu freq 181 | hbus 0x00000003 182 | cpu 0x00010001 183 | 184 | Undefined Instruction 185 | r14_un 186 | PowerPrep start initialize power... 187 | Battery Voltage = 1.62V 188 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 189 | EMI_CTRL 0x1C084040 190 | FRAC 0x92926192 191 | init_ddr_mt46v32m16_133Mhz 192 | power 0x00820710 193 | Frac 0x92926192 194 | start change cpu freq 195 | hbus 0x00000003 196 | cpu 0x00010001 197 | 198 | PowerPrep start initialize power... 199 | Battery Voltage = 0.70V 200 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 201 | EMI_CTRL 0x1C084040 202 | FRAC 0x92926192 203 | init_ddr_mt46v32m16_133Mhz 204 | power 0x00820710 205 | Frac 0x92926192 206 | start change cpu freq 207 | hbus 0x00000003 208 | cpu 0x00010001 209 | 210 | Data Abort 211 | r14_ 212 | PowerPrep start initialize power... 213 | Battery Voltage = 1.62V 214 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 215 | EMI_CTRL 0x1C084040 216 | FRAC 0x92926192 217 | init_ddr_mt46v32m16_133Mhz 218 | power 0x00820710 219 | Frac 0x92926192 220 | start change cpu freq 221 | hbus 0x00000003 222 | cpu 0x00010001 223 | 224 | Data Abort 225 | r14_ 226 | PowerPrep start initialize power... 227 | Battery Voltage = 1.62V 228 | No battery or bad battery detected!!!.Disabling battery voltage ▒ 229 | PowerPrep start initialize power... 230 | Battery Voltage = 1.62V 231 | No battery or bad battery detected!!!.Disabling battery voltage measurements./r/nJul 29 201008:42:31 232 | EMI_CTRL 0x1C084040 233 | FRAC 0x92926192 234 | init_ddr_mt46v32m16_133Mhz 235 | power 0x00820710 236 | Frac 0x92926192 237 | start change cpu freq 238 | hbus 0x00000003 239 | cpu 0x00010001 -------------------------------------------------------------------------------- /MX233/gists/mem-test-failure.txt: -------------------------------------------------------------------------------- 1 | =========================== 2 | Starting device from _start 3 | =========================== 4 | hak8or PowerPrep start initialize power... 5 | Battery Voltage = 1.62VNo battery or bad battery detected! Disabling battery voltage measurements. 6 | raise battery brownout level to programmed value 7 | Switch the Vddd power source to DCDC instead of the linear regulator 8 | Finished PowerPrep_ConfigurePowerSource 9 | LLCFeb 1 201519:34:19 10 | turnon_mem_rail at 2.5v 11 | EMI_CTRL 0x1C084040 12 | FRAC 0x92925E92 13 | Initilizing the 96 Mhz DRAM you want :D 14 | init_ddr_mt46v32m16_96Mhz 15 | power 0x00820710 16 | Frac 0x92925E92 17 | start change cpu freq 18 | hbus 0x00000003 19 | cpu 0x00010001 20 | Done with normal _start routine 21 | 22 | Running just read tests. 23 | mem 0x40000000 => 0x0F0F0F0F 24 | mem 0x40000004 => 0x0F0F0F0F 25 | mem 0x40000008 => 0x0F0F0F0F 26 | mem 0x4000000C => 0x0F0F0F0F 27 | mem 0x40000010 => 0x0F0F0F0F 28 | mem 0x40000014 => 0x0F0F0F0F 29 | mem 0x40000018 => 0x0F0F0F0F 30 | mem 0x4000001C => 0x0F0F0F0F 31 | mem 0x40000020 => 0x0F0F0F0F 32 | mem 0x40000024 => 0x0F0F0F0F 33 | mem 0x40000028 => 0x0F0F0F0F 34 | 35 | =========== Test pass 0 =========== 36 | Filling it with 0 and checking right after. 37 | -- current mem: Addr 0x40000000 -> 0x0F0F0F0F 38 | Filling with: 0x00000000 39 | !!Error!! Got: 0xE1A00000 40 | -- current mem: Addr 0x40000004 -> 0x0F0F0F0F 41 | Filling with: 0x00000000 42 | !!Error!! Got: 0xE1A00000 43 | -- current mem: Addr 0x40000008 -> 0x0F0F0F0F 44 | Filling with: 0x00000000 45 | !!Error!! Got: 0xE1A00000 46 | -- current mem: Addr 0x4000000C -> 0x0F0F0F0F 47 | Filling with: 0x00000000 48 | !!Error!! Got: 0xE1A00000 49 | -- current mem: Addr 0x40000010 -> 0x00000000 50 | Filling with: 0x00000000 51 | -- current mem: Addr 0x40000014 -> 0xE1A00000 52 | Filling with: 0x00000000 53 | -- current mem: Addr 0x40000018 -> 0xE1A00000 54 | Filling with: 0x00000000 55 | -- current mem: Addr 0x4000001C -> 0xE1A00000 56 | Filling with: 0x00000000 57 | -- current mem: Addr 0x40000020 -> 0xE1A00000 58 | Filling with: 0x00000000 59 | -- current mem: Addr 0x40000024 -> 0xE1A00000 60 | Filling with: 0x00000000 61 | -- current mem: Addr 0x40000028 -> 0xE1A00000 62 | Filling with: 0x00000000 63 | Filling it with 0xffffffff and checking right after. 64 | -- current mem: Addr 0x40000000 -> 0x00000000 65 | Filling with: 0xFFFFFFFF 66 | !!Error!! Got: 0xE1A00000 67 | -- current mem: Addr 0x40000004 -> 0x00000000 68 | Filling with: 0xFFFFFFFF 69 | !!Error!! Got: 0xE1A00000 70 | -- current mem: Addr 0x40000008 -> 0x00000000 71 | Filling with: 0xFFFFFFFF 72 | !!Error!! Got: 0xE1A00000 73 | -- current mem: Addr 0x4000000C -> 0x00000000 74 | Filling with: 0xFFFFFFFF 75 | !!Error!! Got: 0xE1A00000 76 | -- current mem: Addr 0x40000010 -> 0x00000000 77 | Filling with: 0xFFFFFFFF 78 | !!Error!! Got: 0xE1A00000 79 | -- current mem: Addr 0x40000014 -> 0x00000000 80 | Filling with: 0xFFFFFFFF 81 | !!Error!! Got: 0xE1A00000 82 | -- current mem: Addr 0x40000018 -> 0xFFFFFFFF 83 | Filling with: 0xFFFFFFFF 84 | -- current mem: Addr 0x4000001C -> 0xE1A00000 85 | Filling with: 0xFFFFFFFF 86 | -- current mem: Addr 0x40000020 -> 0xE1A00000 87 | Filling with: 0xFFFFFFFF 88 | -- current mem: Addr 0x40000024 -> 0xE1A00000 89 | Filling with: 0xFFFFFFFF 90 | -- current mem: Addr 0x40000028 -> 0xE1A00000 91 | Filling with: 0xFFFFFFFF 92 | 93 | =========== Test pass 1 =========== 94 | Filling it with altnerating data and checking right after. 95 | -- current mem: Addr 0x40000000 -> 0xFFFFFFFF 96 | Filling with: 0xFFFFFFFF 97 | -- current mem: Addr 0x40000004 -> 0xE1A00000 98 | Filling with: 0x00000000 99 | -- current mem: Addr 0x40000008 -> 0xE1A00000 100 | Filling with: 0xFFFFFFFF 101 | -- current mem: Addr 0x4000000C -> 0xE1A00000 102 | Filling with: 0x00000000 103 | -- current mem: Addr 0x40000010 -> 0xE1A00000 104 | Filling with: 0xFFFFFFFF 105 | -- current mem: Addr 0x40000014 -> 0xE1A00000 106 | Filling with: 0x00000000 107 | -- current mem: Addr 0x40000018 -> 0xE1A00000 108 | Filling with: 0xFFFFFFFF 109 | -- current mem: Addr 0x4000001C -> 0xE1A00000 110 | Filling with: 0x00000000 111 | -- current mem: Addr 0x40000020 -> 0xE1A00000 112 | Filling with: 0xFFFFFFFF 113 | -- current mem: Addr 0x40000024 -> 0xE1A00000 114 | Filling with: 0x00000000 115 | -- current mem: Addr 0x40000028 -> 0xE1A00000 116 | Filling with: 0xFFFFFFFF 117 | Exiting _status ... 118 | LLLLLLLFCLJ 119 | Data Abort 120 | r14_HTLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFC 121 | 122 | =========================== 123 | Starting device from _start 124 | =========================== 125 | hak8or PowerPrep start initialize power... 126 | Battery Voltage = 1.62VNo battery or bad battery detected! Disabling battery voltage measurements. 127 | raise battery brownout level to programmed value 128 | Switch the Vddd power source to DCDC instead of the linear regulator 129 | Finished PowerPrep_ConfigurePowerSource 130 | LLCFeb 1 201519:34:19 131 | turnon_mem_rail at 2.5v 132 | EMI_CTRL 0x1C084040 133 | FRAC 0x92925E92 134 | Initilizing the 96 Mhz DRAM you want :D 135 | init_ddr_mt46v32m16_96Mhz 136 | power 0x00820710 137 | Frac 0x92925E92 138 | start change cpu freq 139 | hbus 0x00000003 140 | cpu 0x00010001 141 | Done with normal _start routine 142 | 143 | Running just read tests. 144 | mem 0x40000000 => 0x0F0F0F0F 145 | mem 0x40000004 => 0x0F0F0F0F 146 | mem 0x40000008 => 0x0F0F0F0F 147 | mem 0x4000000C => 0x0F0F0F0F 148 | mem 0x40000010 => 0x0F0F0F0F 149 | mem 0x40000014 => 0x0F0F0F0F 150 | mem 0x40000018 => 0x0F0F0F0F 151 | mem 0x4000001C => 0x0F0F0F0F 152 | mem 0x40000020 => 0x0F0F0F0F 153 | mem 0x40000024 => 0x0F0F0F0F 154 | mem 0x40000028 => 0x0F0F0F0F 155 | 156 | =========== Test pass 0 =========== 157 | Filling it with 0 and checking right after. 158 | -- current mem: Addr 0x40000000 -> 0x0F0F0F0F 159 | Filling with: 0x00000000 160 | !!Error!! Got: 0xE1A00000 161 | -- current mem: Addr 0x40000004 -> 0x0F0F0F0F 162 | Filling with: 0x00000000 163 | !!Error!! Got: 0xE1A00000 164 | -- current mem: Addr 0x40000008 -> 0x0F0F0F0F 165 | Filling with: 0x00000000 166 | !!Error!! Got: 0xE1A00000 167 | -- current mem: Addr 0x4000000C -> 0x0F0F0F0F 168 | Filling with: 0x00000000 169 | !!Error!! Got: 0xE1A00000 170 | -- current mem: Addr 0x40000010 -> 0x00000000 171 | Filling with: 0x00000000 172 | -- current mem: Addr 0x40000014 -> 0xE1A00000 173 | Filling with: 0x00000000 174 | -- current mem: Addr 0x40000018 -> 0xE1A00000 175 | Filling with: 0x00000000 176 | -- current mem: Addr 0x4000001C -> 0xE1A00000 177 | Filling with: 0x00000000 178 | -- current mem: Addr 0x40000020 -> 0xE1A00000 179 | Filling with: 0x00000000 180 | -- current mem: Addr 0x40000024 -> 0xE1A00000 181 | Filling with: 0x00000000 182 | -- current mem: Addr 0x40000028 -> 0xE1A00000 183 | Filling with: 0x00000000 184 | Filling it with 0xffffffff and checking right after. 185 | -- current mem: Addr 0x40000000 -> 0x00000000 186 | Filling with: 0xFFFFFFFF 187 | !!Error!! Got: 0xE1A00000 188 | -- current mem: Addr 0x40000004 -> 0x00000000 189 | Filling with: 0xFFFFFFFF 190 | !!Error!! Got: 0xE1A00000 191 | -- current mem: Addr 0x40000008 -> 0x00000000 192 | Filling with: 0xFFFFFFFF 193 | !!Error!! Got: 0xE1A00000 194 | -- current mem: Addr 0x4000000C -> 0x00000000 195 | Filling with: 0xFFFFFFFF 196 | !!Error!! Got: 0xE1A00000 197 | -- current mem: Addr 0x40000010 -> 0x00000000 198 | Filling with: 0xFFFFFFFF 199 | !!Error!! Got: 0xE1A00000 200 | -- current mem: Addr 0x40000014 -> 0x00000000 201 | Filling with: 0xFFFFFFFF 202 | !!Error!! Got: 0xE1A00000 203 | -- current mem: Addr 0x40000018 -> 0xFFFFFFFF 204 | Filling with: 0xFFFFFFFF 205 | -- current mem: Addr 0x4000001C -> 0xE1A00000 206 | Filling with: 0xFFFFFFFF 207 | -- current mem: Addr 0x40000020 -> 0xE1A00000 208 | Filling with: 0xFFFFFFFF 209 | -- current mem: Addr 0x40000024 -> 0xE1A00000 210 | Filling with: 0xFFFFFFFF 211 | -- current mem: Addr 0x40000028 -> 0xE1A00000 212 | Filling with: 0xFFFFFFFF 213 | 214 | =========== Test pass 1 =========== 215 | Filling it with altnerating data and checking right after. 216 | -- current mem: Addr 0x40000000 -> 0xFFFFFFFF 217 | Filling with: 0xFFFFFFFF 218 | -- current mem: Addr 0x40000004 -> 0xE1A00000 219 | Filling with: 0x00000000 220 | -- current mem: Addr 0x40000008 -> 0xE1A00000 221 | Filling with: 0xFFFFFFFF 222 | -- current mem: Addr 0x4000000C -> 0xE1A00000 223 | Filling with: 0x00000000 224 | -- current mem: Addr 0x40000010 -> 0xE1A00000 225 | Filling with: 0xFFFFFFFF 226 | -- current mem: Addr 0x40000014 -> 0xE1A00000 227 | Filling with: 0x00000000 228 | -- current mem: Addr 0x40000018 -> 0xE1A00000 229 | Filling with: 0xFFFFFFFF 230 | -- current mem: Addr 0x4000001C -> 0xE1A00000 231 | Filling with: 0x00000000 232 | -- current mem: Addr 0x40000020 -> 0xE1A00000 233 | Filling with: 0xFFFFFFFF 234 | -- current mem: Addr 0x40000024 -> 0xFFFFFFFF 235 | Filling with: 0x00000000 236 | -- current mem: Addr 0x40000028 -> 0xE1A00000 237 | Filling with: 0xFFFFFFFF 238 | Exiting _status ... 239 | LLLLLLLFCL -------------------------------------------------------------------------------- /MX233/gists/readme.md: -------------------------------------------------------------------------------- 1 | Just a collection of gists over time I made for this. Some are scripts some are output files. Left here for archival purposes. 2 | 3 | ### BCB related stuff 4 | - [BCB to SD card](BCB-to-SD-card.sh) 5 | - [Another BCB to SD card but with images](BCB-to-SD-card-with-image.sh) 6 | - [Generate a BCB](gen-a-BCB.cpp) 7 | 8 | ### OSH PCB scripts 9 | - [OSH 4 layer renaming](OSH-4-layer-renaming.sh) 10 | 11 | ### UART logs 12 | - [Initial 4 layer redo boot log](initial-4-layer-redo-boot-log.txt) 13 | - [Memory test failure](mem-test-failure.txt) 14 | - [UART recovery mode log](UART-recovery-mode-log.txt) 15 | 16 | -------------------------------------------------------------------------------- /MX233/hardware/MX_233_Linux.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/MX233/hardware/MX_233_Linux.PDF -------------------------------------------------------------------------------- /MX233/images/DSC_9621_S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/MX233/images/DSC_9621_S.jpg -------------------------------------------------------------------------------- /MX233/images/DSC_9631_S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hak8or/Embedded-Linux-System/9f35bc1c5ec6d7836e515cdb6360b532c91088cd/MX233/images/DSC_9631_S.jpg -------------------------------------------------------------------------------- /MX233/readme.md: -------------------------------------------------------------------------------- 1 | # Freescale I.MX233 Embedded Linux System 2 | 3 | ![Front](images/DSC_9621_S.jpg) 4 | 5 | ### Status 6 | Currently not working due to issues with DRAM not seeming to be stable. Might have to mess with the timings a good bit more as well as lowering the clock from 133 Mhz to 100 Mhz. 7 | 8 | A 22 uF capacitor under the SDHC holder is too tall, causing the SD card to not fully sit in the holder since it can't be closed, so a finger has to be used by pushing the sd card down when in operation. 9 | 10 | **NOTE** Don't bother with the BCB (Boot Control Block) method of booting. It seems that as per the errta, it is bugged for large SD cards (2GB+). To enable booting via normal partitions on the SD card the board has to be booted into recovery mode and opened on the desktop through the bitburner/OTP burner program. Then burn the OTP bits to enable MBR based booting, if you don't burn them then the MCU will always look for a BCB instead of using the MBR. 11 | 12 | ### Resources: 13 | - [Koliqi](https://github.com/koliqi/imx23-olinuxino): amazing resource for start to finish for the mx233 14 | - [Jancc](http://www.jann.cc/2013/02/07/u_boot_for_the_imx233_olinuxino.html): somewhat outdated guide on the MX233 but still workable 15 | - [Karri](http://www.karrikivela.fi/?p=71): New guide on using the mx233, meh quality 16 | 17 | ### Resources blob from OneTab 18 | - [imx233 bootlets and no battery board | Freescale Community](https://community.freescale.com/thread/303722) 19 | - [First Linux board With kicad | LibreCalc](http://www.librecalc.com/en/blog/premier-circuit-linux/) 20 | - [i.MX233: information about SD/MMC boot from BCB | Freescale Community](https://community.freescale.com/thread/311484) 21 | - [iMX233-OLinuXino - Linux on ARM - eewiki](https://www.eewiki.net/display/linuxonarm/iMX233-OLinuXino) 22 | - [IMX233 - Olimex](https://www.olimex.com/wiki/IMX233) 23 | - [All Boards LTIB Config Ubuntu | Freescale Community](https://community.freescale.com/docs/DOC-1442) 24 | - [U-Boot for the iMX233-OLinuXino — Christian's Blog](http://www.jann.cc/2013/02/07/u_boot_for_the_imx233_olinuxino.html) 25 | - [A new SD card image for the iMX233-OLinuXino — Christian's Blog](http://www.jann.cc/2013/02/04/a_new_image_for_the_imx233_olinuxino.html) 26 | - [Index of /pub/archlinuxarm/os/](http://mirror.lug.udel.edu/pub/archlinuxarm/os/) 27 | - [FTDI PID Unbrick](http://www.minipwner.com/index.php/unbrickftdi000) 28 | - [embedded - Why would copying a micro SD card using dd fail to produce a bootable card? - Reverse Engineering Stack Exchange](https://reverseengineering.stackexchange.com/questions/6666/why-would-copying-a-micro-sd-card-using-dd-fail-to-produce-a-bootable-card) 29 | - [SD-card with ArchLinux will not boot on Olimex iMX233-OLinuXino-MAXI](https://www.olimex.com/forum/index.php?topic=606.0) 30 | - [g-lab – u-boot bootloader for imx23-olinuxino board](http://g-lab.ca/u-boot-bootloader-for-imx23-olinuxino-board/) 31 | - [Newbie question: can iMx233 Olinuxino-Micro boot from USB?](https://www.olimex.com/forum/index.php?topic=3590.5;wap2) 32 | - [dcfldd](http://dcfldd.sourceforge.net/) 33 | - [sasamy.narod.ru/IMX23_ROM_Error_Codes.pdf](http://sasamy.narod.ru/IMX23_ROM_Error_Codes.pdf) 34 | - [i.MX233 board USB not detected on win 7 | Freescale Community](https://community.freescale.com/thread/303440) 35 | - [Booting custom I.MX233 board via BCB | Freescale Community](https://community.freescale.com/thread/321792) 36 | - [iMX233-OLINUXINO SOFTWARE DEVELOPMENT PROGRESS | olimex](http://olimex.wordpress.com/2012/04/20/imx233-olinuxino-software-development/) 37 | - [Re: Re: Re: Re: i.MX233 Hand-Held Multimedia Board - Google Groups](https://groups.google.com/forum/#!topic/rockboxplayer/kRdNDXUpfzw) 38 | - [mx233 HTLLC - Google Search](https://www.google.com/search?q=x80502004&rlz=1C1CHFX_enUS593US593&oq=x80502004&aqs=chrome..69i57.1279j0j1&sourceid=chrome&es_sm=122&ie=UTF-8#newwindow=1&q=mx233+HTLLC) 39 | - [iMX233-OLinuXino - Linux on ARM - eewiki](https://ww.eewiki.net/pages/viewpage.action?pageId=20349076) 40 | - [mx233 bcb signature - Google Search](https://www.google.com/search?q=mx233+bcb+signature&rlz=1C1CHFX_enUS593US593&oq=mx233+bcb+signature&aqs=chrome..69i57.7118j0j9&sourceid=chrome&es_sm=122&ie=UTF-8) 41 | - [sasamy.narod.ru/IMX23_ROM_Error_Codes.pdf](http://sasamy.narod.ru/IMX23_ROM_Error_Codes.pdf) -------------------------------------------------------------------------------- /MX233/scripts/imx_bootlets/compile_and_write.sh: -------------------------------------------------------------------------------- 1 | # Original 2 | # make CROSS_COMPILE=arm-linux-gnueabi- BOARD=imx23_olinuxino_dev MEM_TYPE=MEM_DDR1 3 | 4 | make clean 5 | 6 | make CROSS_COMPILE=arm-none-eabi- 7 | 8 | echo "Wiping the SD card" 9 | ./wipe.sh 10 | 11 | ./display.sh 12 | 13 | echo "Copying bootlet to SD card" 14 | dd if=sd_mmc_bootstream.raw of=/dev/sdb1 15 | sync 16 | 17 | ./display.sh -------------------------------------------------------------------------------- /MX233/scripts/imx_bootlets/create_updater.sh: -------------------------------------------------------------------------------- 1 | cp ${1}/boot/updater_prebuilt.db ${TOP} 2 | cd ${TOP} 3 | sed -i "s,[^ *]zImage.*;,\tzImage=\"${1}/boot/zImage\";," updater_prebuilt.db 4 | sed -i "s,[^ *]sdram_prep.*;,\tsdram_prep=\"${1}/boot/boot_prep\";," updater_prebuilt.db 5 | sed -i "s,[^ *]linux_prep.*;,\tlinux_prep=\"${1}/boot/linux_prep\";," updater_prebuilt.db 6 | sed -i "s,[^ *]power_prep.*;,\tpower_prep=\"${1}/boot/power_prep\";," updater_prebuilt.db 7 | 8 | elftosb2 -d -z -c updater_prebuilt.db -o updater.sb 9 | 10 | rm -f updater_prebuilt.db 11 | 12 | -------------------------------------------------------------------------------- /MX233/scripts/imx_bootlets/display.sh: -------------------------------------------------------------------------------- 1 | echo "Wiping possible old dumps ... \c" 2 | rm sdb_8 3 | rm sdb1_8 4 | rm sdb2_8 5 | rm sdb2_end 6 | rm sdb_end 7 | echo "OK" 8 | 9 | echo "Dumping various points on the card ... " 10 | dd if=/dev/sdb of=sdb_8 bs=512 count=8 11 | sync 12 | 13 | dd if=/dev/sdb1 of=sdb1_8 bs=512 count=8 14 | sync 15 | 16 | dd if=/dev/sdb2 of=sdb2_8 bs=512 count=8 17 | sync 18 | 19 | dd if=/dev/sdb2 of=sdb2_end bs=512 skip=31289340 20 | sync 21 | 22 | dd if=/dev/sdb of=sdb_end bs=512 skip=31324159 23 | sync 24 | echo "OK" 25 | 26 | echo "\n========== SDB first 8 sectors ==========" 27 | echo "If card uses an MBR, contains a magic num of 0x55AA here somewhere!" 28 | hd sdb_8 29 | 30 | echo "\n========== SDB1 first 8 sectors ==========" 31 | hd sdb1_8 32 | 33 | echo "\n========== SDB2 first 8 sectors ==========" 34 | hd sdb2_8 35 | 36 | echo "\n========== SDB2 last few sectors ==========" 37 | hd sdb2_end 38 | 39 | echo "\n========== SDB last few sectors ==========" 40 | echo "If card uses an BCB, contains a magic num of 0x33221100 here somewhere!" 41 | hd sdb_end -------------------------------------------------------------------------------- /MX233/scripts/imx_bootlets/wipe.sh: -------------------------------------------------------------------------------- 1 | echo "Wiping contents of first partition (U-BOOT)." 2 | dd if=/dev/zero of=/dev/sdb1 bs=512K count=1 3 | sync 4 | 5 | # echo "Wiping first 512KB of second partiton (kernel + rootfs)." 6 | # dd if=/dev/zero of=/dev/sdb2 bs=512K count=1 7 | # sync 8 | 9 | # echo "Wiping last few sectors of second partiton (ensures BCB is gone)." 10 | # dd if=/dev/zero of=/dev/sdb2 bs=512 seek=31255576 11 | # sync 12 | 13 | # echo "Wiping the first 84 MB of second partiton (kernel + rootfs)" 14 | # dd if=/dev/zero of=/dev/sdb2 bs=1M count=84 15 | # sync 16 | 17 | # echo "Wiping the MBR, Partition table, etc." 18 | # dd if=/dev/zero of=/dev/sdb bs=512K count=1 19 | # sync 20 | -------------------------------------------------------------------------------- /MX233/scripts/jancc/clean.sh: -------------------------------------------------------------------------------- 1 | rm elftosb-10.12.01.tar.gz 2 | rm -r -f elftosb-10.12.01 3 | 4 | rm gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2 5 | rm -r -f gcc-arm-none-eabi-4_7-2013q1 6 | 7 | rm -r -f u-boot.git 8 | rm u-boot.sb -------------------------------------------------------------------------------- /MX233/scripts/jancc/copy_to_sdcard.sh: -------------------------------------------------------------------------------- 1 | echo "Clear the SD card partition first" 2 | dd if=/dev/zero of=/dev/sdb1 3 | 4 | echo "And now we write it to the SD card." 5 | dd if=uboot.sb of=/dev/sdb1 bs=512 6 | 7 | echo "Sync things up to make sure we are right" 8 | sync 9 | 10 | echo "Dumping the image to check if things went back" 11 | mkdir verification_dumps 12 | cd verification_dumps 13 | rm part1_dump 14 | dd if=/dev/sdb1 of=part1_dump 15 | sync 16 | 17 | 18 | echo "Done, take out the card" 19 | -------------------------------------------------------------------------------- /MX233/scripts/jancc/master_script.sh: -------------------------------------------------------------------------------- 1 | git clone git://git.denx.de/u-boot.git u-boot.git 2 | cd u-boot.git/ 3 | git checkout v2013.07 -b tmp 4 | wget -c https://raw.github.com/eewiki/u-boot-patches/master/v2013.07/0001-mx23_olinuxino-uEnv.txt-bootz-n-fixes.patch 5 | patch -p1 < 0001-mx23_olinuxino-uEnv.txt-bootz-n-fixes.patch 6 | wget -c https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/master/alarm/uboot-olinuxino/alarm.patch 7 | patch -p1 < alarm.patch 8 | 9 | # For debugging with SJtag 10 | wget -c http://www.jann.cc/_downloads/serial_jtag_activation_for_u-boot.patch 11 | patch -p1 < serial_jtag_activation_for_u-boot.patch 12 | 13 | # Get out of the git repo. 14 | cd .. 15 | 16 | # Download the Arm bare metal cross-compiler from launchpad 17 | wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q1-update/+download/gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2 18 | tar -xjf gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2 19 | 20 | # Add the new toolchain to path 21 | # echo "export PATH=\$PATH:`pwd`/gcc-arm-none-eabi-4_7-2013q1/bin" >> ~/.bashrc 22 | echo "export PATH=\$PATH:`pwd`/gcc-arm-none-eabi-4_7-2013q1/bin" >> ~/.zshrc 23 | # source ~/.bashrc 24 | source ~/.zshrc 25 | 26 | # And check that change. 27 | echo "=================================================" 28 | which arm-none-eabi-gcc 29 | echo "=================================================" 30 | 31 | # Get the elftosb file to do that crazy encryption nonsense. 32 | wget http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/elftosb-10.12.01.tar.gz 33 | tar -xzf elftosb-10.12.01.tar.gz 34 | cd elftosb-10.12.01/ 35 | 36 | # Some more patches. 37 | wget wget http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/elftosb-10.12.01-libm.patch 38 | patch -p1 < elftosb-10.12.01-libm.patch 39 | wget http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/elftosb-10.12.01-fix-header-path.patch 40 | patch -p1 < elftosb-10.12.01-fix-header-path.patch 41 | 42 | # Make elftosb 43 | make 44 | 45 | # Do some funky symlinking. 46 | cp bld/linux/elftosb /usr/local/bin 47 | ln -s /usr/local/bin/elftosb /usr/local/bin/elftosb2 48 | 49 | # Go back into the git repo 50 | cd ../u-boot.git/ 51 | 52 | # And compile uboot. 53 | make ARCH=arm CROSS_COMPILE=arm-none-eabi- distclean 54 | make ARCH=arm CROSS_COMPILE=arm-none-eabi- mx23_olinuxino_config 55 | make ARCH=arm CROSS_COMPILE=arm-none-eabi- u-boot.sb 56 | # The u-boot.sb step should call elftosb!!! 57 | 58 | # Copy the sb file out of the uboot dir for easier access. 59 | cp u-boot.sb ../uboot.sb -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | * [Introduction](readme.md) 4 | * [SAM9N12](AT91SAM9N12/readme.md) 5 | * [SAM-BA](AT91SAM9N12/SAMBA.md) 6 | * [AT91 Bootstrap](AT91SAM9N12/AT91_Bootstrap.md) 7 | * [Device Tree](AT91SAM9N12/devicetree.md) 8 | * [Buildroot](AT91SAM9N12/buildroot.md) 9 | * [zImage minifying](AT91SAM9N12/smallerzimage.md) 10 | * [USB](AT91SAM9N12/USB.md) 11 | * [Contributing to Kernel](AT91SAM9N12/Contributing_Kernel.md) 12 | * [Networking](AT91SAM9N12/Networking.md) 13 | * [Packages](AT91SAM9N12/Packages.md) 14 | * [Replicating](AT91SAM9N12/replicate.md) 15 | * [Final Thoughts](AT91SAM9N12/FinalThoughts.md) 16 | * [Old School](AT91SAM9N12/OldSchool/readme.md) 17 | * [MX233](MX233/readme.md) 18 | -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["todo", "ga"], 3 | "pluginsConfig": { 4 | "ga": { 5 | "token": "UA-118727190-1" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Embedded Linux System 2 | 3 | ## Description and why 4 | 5 | ![Home "Lab" as of 2014](DSC_9296.jpg) 6 | 7 | I like to dabble in embedded systems, this is my bread and butter. During college I was able to take an "Independent Study" course, which lets you do any project you want in replacement of a normal class. Since I did projects on my own anyways, this was awesome. At the time I really wanted to do a Linux capable board but at the time found most information on this to be targeting people whom are already experienced in this, or in other words, very little material for someone just getting started. 8 | 9 | This projects therefore served three purposes; first to make a Linux capable board because that's just too awesome, secondly to create a guide (and reference for myself) for someone who was exactly in my situation in terms of knowledge, and thirdly to get those three credits. This was done using hardware available to me as a hobbyist (Broadcom scoffs at emails asking for pricing in small volume from mere mortals like myself) in 2015, and limitations of OSH Park's 4 layer service to make PCB's. 10 | 11 | Please note, this writeup is **still in progress**! Typos and wierd grammar galore. 12 | 13 | ## Structure 14 | This is divided into two designs, [one design](AT91SAM9N12/readme.md) being Atmel's AT91SAM9N12 which is the currently working board, and [the other](MX233/readme.md) being Freescale's I.MX223. Each project directory contains schematics, board files, potentially necessary patches, and various helper scripts. 15 | 16 | Also, here are some [pictures](https://goo.gl/photos/XjbDx4G7ZKULxgLcA) of the designs in progress. 17 | 18 | ## Thanks Henrik! 19 | For those who don't know, Henrik made [a board](http://hforsten.com/making-embedded-linux-computer.html) based on Atmel's SAM9N12 SoC (which I heavily used as a reference) roughly a year ago. This is what showed me as well as likely hundreds of others that such a thing is possible to do at home without thousands of dollars in equipment. His fantastic walkthrough is what inspired for me and guided me through nights of confusion and bewilderment, and if it weren't for him and his walkthrough this would have not been possible. So, Henrik, thank you! 20 | 21 | ## Propagation 22 | - [Reddit](https://www.reddit.com/r/electronics/comments/3184up/inspired_by_henriks_embedded_linux_system_i_made/) 23 | - [Hackaday](http://hackaday.com/2015/04/10/building-super-small-linux-computers-from-scratch/) 24 | - [Dangerous Prototypes](http://dangerousprototypes.com/2015/04/07/embedded-linux-system/) 25 | - [ARM](http://community.arm.com/groups/embedded/blog/2015/04/16/maker-builds-a-diy-embedded-linux-computer) 26 | - [Elektroda.pl](http://www.elektroda.pl/rtvforum/topic3019687.html) 27 | --------------------------------------------------------------------------------