2009-06-12 01:49:09     Inclusion of assembly language in C code.

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-06-12 01:49:09     Inclusion of assembly language in C code.

Rekha B (INDIA)

Message: 75572   

 

Hi ,

 

How to include the following assembly code in C function

 

    /* Issue soft reset */

    P0.L = LO(SWRST) ;

    P0.H = HI(SWRST) ;

    R0.L = 0x0007 ;

    W[P0] = R0 ;

    SSYNC ;

    /* Clear soft reset */

    P0.L = LO(SWRST) ;

    P0.H = HI(SWRST) ;

    R0.L = 0x0000 ;

    W[P0] = R0 ;

    SSYNC ;

    /* Core reset - forces reboot */

    RAISE 1 ;

 

 

Thanks.

QuoteReplyEditDelete

 

 

2009-06-12 03:50:40     Re: Inclusion of assembly language in C code.

Mike Frysinger (UNITED STATES)

Message: 75575   

 

for inline assembly, please read the documentation:

  docs.blackfin.uclinux.org/doku.php?id=using_in-line_assembly_calling_external_assembly_from_c&s[]=inline

 

that said, your reset code is wrong.  if you're using Linux, there is no reason for you to be executing that code at all -- use the reboot from the kernel.

QuoteReplyEditDelete

 

 

2009-06-15 02:51:41     Re: Inclusion of assembly language in C code.

Rekha B (INDIA)

Message: 75671   

 

Hi,

 

I have used "bfin_reset()" call for resetting the system but rebooting is not proper,

 

Following were its logs,

 

# U-Boot 1.1.6-svn (ADI-2007R1) (Sep 23 2008 - 20:59:33)

 

CPU:   ADSP BF533 Rev.: 0.5

Board: ADI BF533 NP2x00 board

Support: www.philips.com

Clock: VCO: 594 MHz, Core: 594 MHz, System: 118 MHz

SDRAM: 64 MB

FLASH:   8 MB

*** Warning - bad CRC, using default environment

 

In:    serial

Out:   serial

Err:   serial

I2C:   ready

Hit any key to stop autoboot:  0

## Booting image at 20090000 ...

   Image Name:   Linux-2.6.22.19-ADI-2008R1.5-svn

   Created:      2009-06-11  13:26:16 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    5480220 Bytes =  5.2 MB

   Load Address: 00180000

   Entry Point:  002d4000

   Verifying Checksum ... crc32 = 0xfba00ee4

OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 2d4000    -------------------------------------> Stops at this stage.

 

 

 

2. Also when i use "RAISE 1" instruction alone , rebooting was proper.

 

3. Is that appreciable to use "RAISE 1" instruction for system reboot?

 

Kindly let us know wat is the difference?

 

Version used : release2008R1.5

QuoteReplyEditDelete

 

 

2009-06-15 03:14:47     Re: Inclusion of assembly language in C code.

Mike Frysinger (UNITED STATES)

Message: 75672   

 

that shows the kernel hanging, not rebooting.  i dont see why you think rebooting is related.  you can always read the log manually:

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:debug:post_mortem

 

the *only* supported reset method is using the bfin_reset() functions.  using raise or swrst is absolutely not supported.  if you attempt to use those things, you are on your own for everything else -- an improper reset can cause other bugs to randomly show up.

 

your u-boot is way out of date.  upgrade to at least 2008R1.5.

Attachments

    Outcomes