Para ativar as mensagens de Debug do kernel, edite o arquivo Makefile da raiz do kernel adicionando:
CFLAGS_KERNEL = -DDEBUG
a blog about computers and other funny things
Month: December 2018
Para ativar as mensagens de Debug do kernel, edite o arquivo Makefile da raiz do kernel adicionando:
CFLAGS_KERNEL = -DDEBUG
# dfu-util -d 1d50:607f -a 0 -s 0x08005000:leave -D core-firmware.bin
It is always a good idea to make backup of your pictures to your computer or using some cloud sync solution as Dropbox to make your pictures safe.
But not everybody does that. If you don’t, consider start doing it.
I friend of mine was bored because her smartphone was slow (Samsung Gran Prime DUOS) and she cannot take pictures or record video without waiting a long time.
Then I decided to do Factory Reset for her, but I didn’t backup her pictures, then when we restarted the Android only the old picture from external memory card (2GB disk) was there, all other pictures were lost!
I decided to recovery all file for disk and searching in the internet I found this nice tutorial: http://dflund.se/~jokke/androidfilerecovery/
Unfortunately after download the raw content of /dev/block/mmcblk0 and running the “testdisk” program I noticed that the partition was not shown.
http://www.noah.org/wiki/Forensics,_Undelete,_and_Data_Recovery
$ ./tools/configure.sh saml21-xplained/nsh
$ make menuconfig
(change build system to Linux)
$ make
$ JLinkExe -device ATSAML21G18 -if SWD
J-Link>connect
Connecting to J-Link via USB…O.K.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
S/N: 268006167
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref=2.005V
Specify target interface speed [kHz]. : 4000 kHz
Speed>
Device “ATSAML21G18” selected.
Connecting to target via SWD
InitTarget()
Found SW-DP with ID 0x0BC11477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770031)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0x41003000
CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)
Found Cortex-M0 r0p1, Little endian.
FPUnit: 4 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ 41003000
ROMTbl[0][0]: E00FF000, CID: B105100D, PID: 000BB4C0 ROM Table
ROMTbl[1] @ E00FF000
ROMTbl[1][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS
ROMTbl[1][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT
ROMTbl[1][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB
ROMTbl[0][1]: 41006000, CID: B105900D, PID: 001BB932 MTB-M0+
Cortex-M0 identified.
J-Link>
J-Link>loadbin nuttx.hex 0
Halting CPU for downloading file.
Downloading file [nuttx.hex]…
Comparing flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
O.K.
J-Link>
Connect your 3.3V USB/Serial GND pin to EXT1 GND, RXD to PB08 and TXD to PB09.
I noticed that gdb-arm-none-eabi package is not present on Ubuntu 18.04 repository. After some searches I saw people suggesting to use gdb-multiarch, but this gdb didn’t work for me.
Then after more some searching I found the solution is easy: just download and install this package from Xenial (Ubuntu 16.04) :
https://packages.ubuntu.com/xenial/gdb-arm-none-eabi
https://packages.ubuntu.com/xenial/libreadline6
$ sudo dpkg -i libreadline6_6.3-8ubuntu2_amd64.deb
$ sudo dpkg -i gdb-arm-none-eabi_7.10-1ubuntu3+9_amd64.deb
Source: https://bugs.launchpad.net/ubuntu/+source/chkconfig/+bug/1763006
NuttX has support to Freedom K64F and the README file (see nuttx/configs/freedom-k64f/README.txt) give much information about things it supports.
After plugging it on my computer (connected to SDA USB connector) I saw these messages after running dmesg:
$ dmesg
[ 194.521661] usb 3-3: new full-speed USB device number 3 using xhci_hcd
[ 194.671658] usb 3-3: New USB device found, idVendor=0d28, idProduct=0204
[ 194.671663] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 194.671667] usb 3-3: Product: MBED CMSIS-DAP
[ 194.671670] usb 3-3: Manufacturer: MBED
[ 194.671672] usb 3-3: SerialNumber: 024002015928CE6CA4DXXXXXX
[ 194.674782] hid-generic 0003:0D28:0204.0005: hiddev0,hidraw4: USB HID v1.00 Device [MBED MBED CMSIS-DAP] on usb-0000:00:14.0-3/input3
[ 194.744180] cdc_acm 3-3:1.1: ttyACM0: USB ACM device
[ 194.744627] usbcore: registered new interface driver cdc_acm
[ 194.744629] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 194.765883] usb-storage 3-3:1.0: USB Mass Storage device detected
[ 194.766177] scsi host6: usb-storage 3-3:1.0
[ 194.766444] usbcore: registered new interface driver usb-storage
[ 194.783993] usbcore: registered new interface driver uas
[ 195.794345] scsi 6:0:0:0: Direct-Access MBED microcontroller 1.0 PQ: 0 ANSI: 2
[ 195.795065] sd 6:0:0:0: Attached scsi generic sg2 type 0
[ 195.795296] sd 6:0:0:0: [sdb] 2096 512-byte logical blocks: (1.07 MB/1.02 MiB)
[ 195.795482] sd 6:0:0:0: [sdb] Write Protect is off
[ 195.795486] sd 6:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 195.795666] sd 6:0:0:0: [sdb] No Caching mode page found
[ 195.795674] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 195.803484] sdb:
[ 195.804512] sd 6:0:0:0: [sdb] Attached SCSI removable disk
Also the MBED partition appeared on nautilus file explorer with mbed.htm file on it.
So it is show time:
$ cd nuttxspace/nuttx $ make distclean $ ./tools/configure.sh freedom-k64f/nsh
$ make menuconfig
Build Setup ---> Build Host Platform (Linux) --->
wow, nice it was already configured to Linux!
Binary Output Formats ---> [*] Raw binary format
But the Raw binary format wasn’t selected.
Leave and save and then run the magical compilation command:
$ make
I had not luck flashing the firmware nuttx.bin just dropping it on MBED partition. Also using the OpenSDA firmware with OpenOCD to flash didn’t work! Fortunately you can use the Segger Jlink firmware “J-Link OpenSDA – Board-Specific Firmwares”:
https://www.segger.com/downloads/jlink#JLinkOpenSDABoardSpecificFirmwares
With the board powered-off press and hold the reset button (RESET SW1) and connect the USB cable to the computer. When the BOOTLOADER directory appear on your file explorer drop the 02_OpenSDA_FRDM-K64F.bin there!
Reset the board, install the Jlink software tool for Linux and run:
$ JLinkExe -if SWD -device MK64FN1M0xxx12 SEGGER J-Link Commander V6.40 (Compiled Oct 26 2018 15:08:38) DLL version V6.40, compiled Oct 26 2018 15:08:28 Connecting to J-Link via USB…O.K. Firmware: J-Link OpenSDA 2 compiled Oct 10 2018 16:29:19 Hardware version: V1.00 S/N: 621000000 VTref=3.300V Type "connect" to establish a target connection, '?' for help J-Link>connect Specify target interface speed [kHz]. : 4000 kHz Speed> 4000 Device "MK64FN1M0XXX12" selected. Connecting to target via SWD InitTarget() Found SW-DP with ID 0x2BA01477 Scanning AP map to find all available APs AP[2]: Stopped AP scan as end of AP map has been reached AP[0]: AHB-AP (IDR: 0x24770011) AP[1]: JTAG-AP (IDR: 0x001C0000) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410FC241. Implementer code: 0x41 (ARM) Found Cortex-M4 r0p1, Little endian. FPUnit: 6 code (BP) slots and 2 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7 ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM ROMTbl[0][6]: E0042000, CID: B105900D, PID: 003BB907 ETB ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF Cortex-M4 identified. J-Link>loadbin ./nuttx.bin 0 Downloading file [./nuttx.bin]… Comparing flash [100%] Done. Erasing flash [100%] Done. Programming flash [100%] Done. Verifying flash [100%] Done. J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (81920 bytes) J-Link: Flash download: Total time needed: 1.024s (Prepare: 0.043s, Compare: 0.013s, Erase: 0.024s, Program: 0.930s, Verify: 0.005s, Restore: 0.007s) O.K. J-Link> exit
The RGB LED will turn on in Green color