This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CBZ instruction does not compile

In ARM v7-A-R Architecture Reference Manual.pdf I can read:

CBNZ, CBZ

Compare and Branch on Nonzero and Compare and Branch on Zero compare the value in a register with zero, and

conditionally branch forward a constant value. They do not affect the condition flags.

But when I try to use it I got an illegal mnemonic error.

  • Please show us the exact contents of the line you are trying to assemble.  Please show us the exact assembler command-line options; you can find them in the build console.  Please show us the compiler version (it is not the same as the CCS version).

  • Hello,

    I hope the following correspond to your request :

    adcstartConv1     adcTstConvCpl          #adcREG1,#1              ;wait for the conversion complete adc groupe 1
                                CBZ                            r0,adcstartConv1       ;Compare and Branch if 0,

    Compiler version : v5.1.1


    ${command} ${flags} ${inputs}
    Summary of flags set:
    -mv7R4 --code_state=32 --float_support=VFPv3D16 --abi=eabi -me -O0 --fp_mode=relaxed --include_path="D:/A_TI_CCS_Studio/ccsv5/tools/compiler/arm_5.1.1/include" --include_path="D:/A_TI_CCS_Workspace/ass-HCG-adc-G0/include_init" --include_path="D:/A_TI_CCS_Workspace/ass-HCG-adc-G0/include_appli" --include_path="D:/A_TI_CCS_Workspace/ass-HCG-adc-G0/include" -g --diag_warning=225 --display_error_number --diag_wrap=off --enum_type=packed

    regards

    Jerome

  • There are two different problems to address.

    One, CBZ is a Thumb only instruction.  Add the build option --code_state=16 or use the directive .thumb.

    Two, CBZ can only branch forward, not backward.

    Thanks and regards,

    -George

  • George,

    Thanks for your explanation

    Regards