ARM::CMSIS 5.8.0 breaks __nop() and__disable_irq() ??

I've been learning STM32F1 using the eval Keil MDK and though I'm a confused newbie at ARM/STM32 it's been going OK.  This Monday morning my project would no longer compile and there were lots of errors and messages about __nop(); and __disable_irq(); 

I think it might be because of an update I did, though I can't recall specifically what update I performed (I know, I'm an idiot ... Friday afternoons should never be the time to update anything!).  It appears the errors come about because of missing header files under system_stm32f10x.c/stm32f10x.h. It took me a long time to figure out how to "correct" for the error and I had to change:

Select Software Packs -> deselect Use Latest version    and then manually select 5.7.0 instead of 5.8.0.

Can someone explain to me what's going on?  Is there something else I'm doing wrong? Should I try and remove/reinstall 5.8.0?

  • Build success ouput:


    Rebuild started: Project: MatrixTest
    *** Using Compiler 'V6.16', folder: 'C:\Keil_v5_MDK\ARM\ARMCLANG\Bin'
    Rebuild target 'Target 1'
    compiling MyQueue.c...
    compiling MyMatrix.c...
    compiling MyGpio.c...
    compiling Main.c...
    compiling MyAssert.c...
    compiling MyLcd.c...
    compiling MySysClock.c...
    compiling MyTimer.c...
    assembling startup_stm32f10x_md.s...
    compiling system_stm32f10x.c...
    compiling MyUart.c...
    linking...
    Program Size: Code=12014 RO-data=350 RW-data=4 ZI-data=2128  
    ".\Objects\MatrixTest.axf" - 0 Error(s), 0 Warning(s).
    Build Time Elapsed:  00:00:01

    Build failure output:

    Rebuild started: Project: MatrixTest
    *** Using Compiler 'V6.16', folder: 'C:\Keil_v5_MDK\ARM\ARMCLANG\Bin'
    Rebuild target 'Target 1'
    compiling MyAssert.c...
    Source/MyLcd.c(272): error: assigning to 'unsigned int' from incompatible type 'void'
    was_masked = __disable_irq();               // See note.
               ^ ~~~~~~~~~~~~~~~
    Source/MyLcd.c(323): error: assigning to 'unsigned int' from incompatible type 'void'
    was_masked = __disable_irq();
               ^ ~~~~~~~~~~~~~~~
    Source/MyLcd.c(467): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
          T_AS();                          // Tas = 140ns.
          ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(498): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
          T_AS();                          // Tas = 140ns.
          ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(525): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
       T_AS();                             // Tas = 140ns
       ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(631): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
          T_AS();                          // Tas = 140ns
          ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(654): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
          T_AS();                          // Tas = 140ns
          ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(716): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
       T_AS();                             // Tas = 140ns
       ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(727): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
       T_AS();                             // Tas = 140ns
       ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(770): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
       T_AS();                             // Tas = 140ns
       ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    Source/MyLcd.c(781): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
       T_AS();                             // Tas = 140ns
       ^
    Source/MyLcd.c(158): note: expanded from macro 'T_AS'
    #define T_AS()  __nop();__nop();__nop(); \
                    ^
    9 warnings and 2 errors generated.
    compiling MyLcd.c...
    compiling MyMatrix.c...
    compiling MyQueue.c...
    compiling MyGpio.c...
    Source/Main.c(78): warning: implicit declaration of function '__nop' is invalid in C99 [-Wimplicit-function-declaration]
    __nop();                               // Delay if Cortex M3 has a write buffer?. Read-back would be better?
    ^
    1 warning generated.
    compiling Main.c...
    compiling MySysClock.c...
    compiling MyTimer.c...
    Source/MyUart.c(409): error: assigning to 'unsigned int' from incompatible type 'void'
    was_masked = __disable_irq();          // See note above.
               ^ ~~~~~~~~~~~~~~~
    Source/MyUart.c(452): error: assigning to 'unsigned int' from incompatible type 'void'
    was_masked = __disable_irq();          // See note above.
               ^ ~~~~~~~~~~~~~~~
    Source/MyUart.c(490): error: assigning to 'unsigned int' from incompatible type 'void'
    was_masked = __disable_irq();          // See note above.
               ^ ~~~~~~~~~~~~~~~
    Source/MyUart.c(540): error: assigning to 'unsigned int' from incompatible type 'void'
    was_masked = __disable_irq();          // See note above.
               ^ ~~~~~~~~~~~~~~~
    4 errors generated.
    compiling MyUart.c...
    compiling system_stm32f10x.c...
    assembling startup_stm32f10x_md.s...
    ".\Objects\MatrixTest.axf" - 6 Error(s), 10 Warning(s).
    Target not created.
    Build Time Elapsed:  00:00:01
    
    
    
    

  • See https://github.com/ARM-software/CMSIS_5/issues/1211

    For Cert reasons, includes to arm_compat.h was removed.

    if one needs to include arm_compat.h one needs to assure its included before including any CMSIS header.

    Does adding arm_compat.h solve anything?