EmcraftSystems / linux-emcraft

uClinux for Cortex-M3 and Cortex-M4, version 2.6.33
http://www.emcraft.com
Other
266 stars 209 forks source link

Hard Fault Issue When U-Boot Executing #13

Closed muratdemirtas closed 7 years ago

muratdemirtas commented 7 years ago

Hello Dear, thanks a lot of for uCLinux,

I was tried to boot Linux to our TWR-K70F120M Development board. I applied all requirements from your Linux Kinetis BSP Guide for the Freescale TWR-K70F120M Board pdf's . That include(code warrior, elevator modules setup, debugger options, flash operations) etc.

So i prepared Linux System for building u-boot from source code and i can compile u-boot. I successfully flashed to u-boot file to FLASH but problem is when i flashed to u-boot to our development board i see "HARD FAULT exception" on RS232 Serial of elevator serial module.

All u-boot prints listed below. I tried prebuild u-boot image too. But same problem occuring. What's is wrong is here?. Is that jumper or hardware fault?. What can i do? Thanks you.

Prebuilt U-Boot

U-Boot 2010.03-linux-cortexm-1.12.0 (Dec 13 2013 - 16:42:39)

CPU  : Freescale Kinetis series (Cortex-M4)
Freqs: SYSTICK=120MHz,CCLK=120MHz,PCLK=60MHz,MACCLK=50MHz
Board: Freescale TWR-K70F120M rev 1
DRAM:  128 MB
NAND:  256 MiB
Bad block table not found for chip 0
Bad block table not found for chip 0
UNHANDLED EXCEPTION: HARD FAULT
  R0    = ffff0000  R1  = 87f00008
  R2    = 000a0000  R3  = 0000ffff
  R12   = 00000000  LR  = ff0000ff
  PC    = 00008af4  PSR = 01000000

Custom u-boot from i pulled and compiled from emcraft-u github

U-Boot 2010.03 (Sep 18 2017 - 04:39:26)

CPU  : Freescale Kinetis series (Cortex-M4)
Freqs: SYSTICK=120MHz,CCLK=120MHz,PCLK=60MHz,MACCLK=50MHz
Board: Freescale TWR-K70F120M rev 1
DRAM:  128 MB
NAND:  256 MiB
Bad block table not found for chip 0
Bad block table not found for chip 0
UNHANDLED EXCEPTION: HARD FAULT
  R0    = 00020000  R1  = 00040000
  R2    = 000a3f00  R3  = 000a3f38
  R12   = 2000fdd8  LR  = 00000f1d
  PC    = 00008b4e  PSR = 01000000
sposelenov-emcraft commented 7 years ago

Hello,

PC address of the fault points to fsl_nfc_command(), most probably, check that in System.map. My guess is that something is missed in you hardware setup on your board. Check the NAND part of it - clocking, power, data and control lines.

Regards, Sergei Poselenov, Emcraft Systems

On 18.09.2017 4:55, Murat Demirtaş wrote:

|Hello Dear, thanks a lot of uCLinux, |

I was tried to boot Linux to our TWR-K70F120M Development board. I applied all requirements from your Linux Kinetis BSP Guide for the Freescale TWR-K70F120M Board pdf's . That include(code warrior, elevator modules setup, debugger options, flash operations) etc.

So i prepared Linux System for building u-boot from source code and i can compile u-boot. I successfully flashed to u-boot file to FLASH but problem is when i flashed to u-boot to our development board i see "HARD FAULT exception" on RS232 Serial of elevator serial module.

All u-boot prints listed below. I tried prebuild u-boot image too. But same problem occuring. What's is wrong is here?. Is that jumper or hardware fault?. What can i do? Thanks you.

Prebuilt U-Boot `U-Boot 2010.03-linux-cortexm-1.12.0 (Dec 13 2013 - 16:42:39)

CPU : Freescale Kinetis series (Cortex-M4) Freqs: SYSTICK=120MHz,CCLK=120MHz,PCLK=60MHz,MACCLK=50MHz Board: Freescale TWR-K70F120M rev 1 DRAM: 128 MB NAND: 256 MiB Bad block table not found for chip 0 Bad block table not found for chip 0 UNHANDLED EXCEPTION: HARD FAULT R0 = ffff0000 R1 = 87f00008 R2 = 000a0000 R3 = 0000ffff R12 = 00000000 LR = ff0000ff PC = 00008af4 PSR = 01000000`

Custom u-boot from i pulled from emcraft-u boot github

`U-Boot 2010.03 (Sep 18 2017 - 04:39:26)

CPU : Freescale Kinetis series (Cortex-M4) Freqs: SYSTICK=120MHz,CCLK=120MHz,PCLK=60MHz,MACCLK=50MHz Board: Freescale TWR-K70F120M rev 1 DRAM: 128 MB NAND: 256 MiB Bad block table not found for chip 0 Bad block table not found for chip 0 UNHANDLED EXCEPTION: HARD FAULT R0 = 00020000 R1 = 00040000 R2 = 000a3f00 R3 = 000a3f38 R12 = 2000fdd8 LR = 00000f1d PC = 00008b4e PSR = 01000000`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EmcraftSystems/linux-emcraft/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjpXwWv8LX9bWvwSQk6Yh2JgjnYxQpnks5sjlpCgaJpZM4PazAd.

muratdemirtas commented 7 years ago

Thanks for your quick answer

My development board from Freescale TWR-K70F120M. I know bootloader must be install to MCU integrated flash memory but this board also have micron MT29F2G16 2GB nand flash should i select this device from flash programmer task?. i checked my board configuration and i cant find any issues.

I can erase and blank check on the onboard MT29F2G16 2GB Nand Flash using CodeWarrior Studio. Seems no error.

edit: I removed serial tower board and configured u-boot outputs of debug messages to OSJTAG serial port. Now i dont need serial elevator but results is same.

https://hizliresim.org/r/Zhh3b

adsiz

muratdemirtas commented 7 years ago

edit 2: i researched some code of u-boot , i found chip->ecc.read_oob = fsl_nfc_read_oob; functions calling fsl_nfc_read_oob() function. fsl_nfc_read_oob trying to read nand flash. So my problem is must be u-boot cant reach to nand flash sectors? am i sure?

static int fsl_nfc_read_oob(struct mtd_info mtd, struct nand_chip chip, int page, int sndcmd)

{
    puts("nand okuma problemi\r\n");
    fsl_nfc_command(mtd, NAND_CMD_READ0, 0, page);
    puts("nand okuma problemi2\r\n");
    copy_from_to_spare(mtd, chip->oob_poi, mtd->oobsize, 0);
    return 0;
}

serial output

nand okuma problemi2
nand okuma problemi
nand okuma problemi2
nand okuma problemi

UNHANDLED EXCEPTION: HARD FAULT R0 = 00020000 R1 = 00040000 R2 = 000a3f00 R3 = 000a3f38 R12 = 2000fdd8 LR = 00000f41 PC = 00008b92 PSR = 01000000

muratdemirtas commented 7 years ago

after that i can get u-boot terminal but this is not stable. what can i do :)

U-Boot 2010.03 (Sep 19 2017 - 04:53:19)

CPU : Freescale Kinetis series (Cortex-M4) Freqs: SYSTICK=120MHz,CCLK=120MHz,PCLK=60MHz,MACCLK=50MHz Board: Freescale TWR-K70F120M rev 1 DRAM: 128 MB NAND: 256 MiB Bad block table found at page 131008, version 0x01 Bad block table found at page 130944, version 0x01 nand_read_bbt: Bad block at 0x000000000000 *** Warning - bad CRC or NAND, using default environment

In: serial Out: serial Err: serial Net: ### ERROR ### Please RESET the board ###

muratdemirtas commented 7 years ago

after after. :( same problem.. TWR-K70F120M> bootm

Booting kernel from Legacy Image at 08007fc0 ...

Image Name: Linux-2.6.33-arm1
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2325440 Bytes = 2.2 MB
Load Address: 08008000
Entry Point: 08008001
Verifying Checksum ... Bad Data CRC
UNHANDLED EXCEPTION

muratdemirtas commented 7 years ago

my nand flash is corrupted. problem fixed with new twr-k70120m