MISRA Rule 10.1 (blackfin 561 code)

This is a discussion on MISRA Rule 10.1 (blackfin 561 code) within the C Programming forums, part of the General Programming Boards category; Hi, My code for running a blackfin DSP uses pointers to registers to set specific register values. (Found in a ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    13

    MISRA Rule 10.1 (blackfin 561 code)

    Hi,


    My code for running a blackfin DSP uses pointers to registers to set specific register values. (Found in a compiler include file -> cdefBF561.h)


    i.e.


    Code:
    *pSPI_FLG = 0x01;

    however MISRA counts this as an error, "implicit conversion to a different type"


    how can i get around this? any help would be great,


    Matt

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    > pSPI_FLG
    So how is it declared?

    You might try
    0x01u or 0x01ul
    for appropriate unsigned types.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    13
    declared as
    Code:
    #define pSPI_FLG 	(volatile unsigned short *)SPI_FLG

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    13
    ah sorry think i've got it.

    I just need to make sure i cast values to match that declared for each register.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. << !! Posting Code? Read this First !! >>
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 10-03-2002, 03:04 PM
  2. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 11:51 AM
  4. Replies: 0
    Last Post: 02-21-2002, 05:05 PM
  5. Replies: 4
    Last Post: 01-15-2002, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21