This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question : The Definitive Guide to the ARM Cortex-M3

Note: This was originally posted on 11th December 2007 at http://forums.arm.com

Dear, all.

I am new in this forum.
Recently I studying Cortex-M3 core, so I bought book "The Definitive Guide to the ARM Cortex-M3" by Joseph Yiu.
This book is very good book and this explains most of unaswered questions by TRM or AALRM.

As I found some mistake in this book, I would like to feedback, but I could not find publisher's homepage. Then I found Josephe's name in this forum, I would like to ask here.

In page 42, there is fig 3.11 and 3.12 but this contents is same as fig 3.8 and 3.9.
Fig 3.8 and 3.9 should be some program list.

Can I get correct figure? Or where I should contact?
Please advise.

Kenichi
Parents
  • Note: This was originally posted on 11th April 2010 at http://forums.arm.com

    Hi Wave,

    I don't know why the second edition of the book is not available for Kindle.
    (In fact, I didn't even notice the first edition is available on Kindle until you mention it.
    Certainly it is not available in the UK web site)
    I will try to arrange a meeting with the publisher in a few weeks time.
    I will take the chance to ask them.

    Yes, the ARM syntax is indeel more straight forward in term of using conditional execution.
    However, the issue is that we cannot use the same instruction encoding solution for Thumb-2.
    With Thumb-2, a large portion of the the instruction space (in terms of binary encoding)
    is already taken by the existing Thumb instructions. We cannot take 4 bits away from
    the 16-bit instructions to make them conditional - it will means the instructions set will not
    be compatible. Alternatively we could make conditional execution available only on
    the 32-bit Thumb instructions, but then it might results in larger code size because
    16-bit version of the instructions cannot be used if they have to be conditionally executed.

    By using a separate 16-bit instruction for conditional execution control, we get the best results:
    - code size is small (see example below)
    - Both 16-bit and 32-bit Thumb instructions can be conditional executed
    - No need to change existin 16-bit instruction encoding

    When comparing the code size:
    OLD ARM CODE WITH CONDITIONAL EXECUTION:

    CMP R1, #2  (32 bits)
    ADDEQ R0, R1, #1 (32 bits)
    (total = 64 bits)

    NEW CODE WITH IF-THEN:
    CMP R1, #2 (16 bits)
    IT EQ (16 bits)
    ADDEQ R0, R1, #1 (16 bits)
    (total = 48 bits)

    Now you can see the code size is actually smaller than the ARM instruction set, although it has one extra instruction.
    Another feature about the IT instruction is called IT folding. (see instruction timing table in
    [url="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337g/BABBCJII.html"]http://infocenter.arm.com/help/topic/com.a...g/BABBCJII.html[/url] )
    In the some cases, the IT instruction does not take any extra clock cycle.
    (actually, look like there is a doc erratum there, NOP instruction should always take 1 cycle, ouch!)
    So it is possible to get to the same performance as ARM instruction, with a smaller code size.

    If the condition in the IT instruction does not match the condition of the next instruction in the assembly code,
    the assembler will report an error.  However, if you are using ARM RealView Compiler or Keil MDK-ARM, you don't have to add the IT instruction, as the assembler can insert that for you automatically.  However, this feature might not be available in other tool chains. So in general I would recommend to put the IT instruction in the code for clarity and software porting.

    Hope this answered your enquiry.
    regards,
    Joseph
Reply
  • Note: This was originally posted on 11th April 2010 at http://forums.arm.com

    Hi Wave,

    I don't know why the second edition of the book is not available for Kindle.
    (In fact, I didn't even notice the first edition is available on Kindle until you mention it.
    Certainly it is not available in the UK web site)
    I will try to arrange a meeting with the publisher in a few weeks time.
    I will take the chance to ask them.

    Yes, the ARM syntax is indeel more straight forward in term of using conditional execution.
    However, the issue is that we cannot use the same instruction encoding solution for Thumb-2.
    With Thumb-2, a large portion of the the instruction space (in terms of binary encoding)
    is already taken by the existing Thumb instructions. We cannot take 4 bits away from
    the 16-bit instructions to make them conditional - it will means the instructions set will not
    be compatible. Alternatively we could make conditional execution available only on
    the 32-bit Thumb instructions, but then it might results in larger code size because
    16-bit version of the instructions cannot be used if they have to be conditionally executed.

    By using a separate 16-bit instruction for conditional execution control, we get the best results:
    - code size is small (see example below)
    - Both 16-bit and 32-bit Thumb instructions can be conditional executed
    - No need to change existin 16-bit instruction encoding

    When comparing the code size:
    OLD ARM CODE WITH CONDITIONAL EXECUTION:

    CMP R1, #2  (32 bits)
    ADDEQ R0, R1, #1 (32 bits)
    (total = 64 bits)

    NEW CODE WITH IF-THEN:
    CMP R1, #2 (16 bits)
    IT EQ (16 bits)
    ADDEQ R0, R1, #1 (16 bits)
    (total = 48 bits)

    Now you can see the code size is actually smaller than the ARM instruction set, although it has one extra instruction.
    Another feature about the IT instruction is called IT folding. (see instruction timing table in
    [url="http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337g/BABBCJII.html"]http://infocenter.arm.com/help/topic/com.a...g/BABBCJII.html[/url] )
    In the some cases, the IT instruction does not take any extra clock cycle.
    (actually, look like there is a doc erratum there, NOP instruction should always take 1 cycle, ouch!)
    So it is possible to get to the same performance as ARM instruction, with a smaller code size.

    If the condition in the IT instruction does not match the condition of the next instruction in the assembly code,
    the assembler will report an error.  However, if you are using ARM RealView Compiler or Keil MDK-ARM, you don't have to add the IT instruction, as the assembler can insert that for you automatically.  However, this feature might not be available in other tool chains. So in general I would recommend to put the IT instruction in the code for clarity and software porting.

    Hope this answered your enquiry.
    regards,
    Joseph
Children
No data