Giter Club home page Giter Club logo

cmsis_6's Introduction

Version License

CMSIS Version 6

Note: The branch main of this GitHub repository contains our current state of development and gives you contiguous access to the CMSIS development for review, feedback, and contributions via pull requests. For stable versions ready for productive use please refer to tagged releases, like Version.

Useful Links

Other related GitHub repositories

Repository Description
CMSIS-DSP Compute library for various data types: fixed-point (fractional q7, q15, q31) and single precision floating-point (32-bit).
CMSIS-NN Software library of efficient neural network kernels optimized for Arm Cortex-M processors.
CMSIS-FreeRTOS CMSIS adoption of FreeRTOS including CMSIS-RTOS2 API layer.
CMSIS-RTX Keil RTX Real-Time Operating System (CMSIS-RTOS2 native implementation).
CMSIS-Driver Generic MCU driver implementations and templates for Ethernet MAC/PHY and Flash.
CMSIS-Driver_Validation CMSIS-Driver Validation can be used to verify CMSIS-Driver in a user system
cmsis-pack-eclipse CMSIS-Pack Management for Eclipse reference implementation Pack support
CMSIS-Zone CMSIS-Zone Utility along with example projects and FreeMarker templates
NXP_LPC CMSIS Driver Implementations for the NXP LPC Microcontroller Series
mdk-packs IoT cloud connectors as trail implementations for MDK (help us to make it generic)
trustedfirmware.org Arm Trusted Firmware provides a reference implementation of secure world software for Armv8-A and Armv8-M.

Directory Structure

Directory Content
CMSIS/Core CMSIS-Core related files (for release)
CMSIS/CoreValidation Validation for Core(M) and Core(A) (NOT part of pack release)
CMSIS/Driver CMSIS-Driver API headers and template files
CMSIS/RTOS2 RTOS v2 related files (for Cortex-M & Armv8-M)
CMSIS/Documentation Doxygen source of the users guide (NOT part of pack release)

Generate CMSIS Pack for Release

This GitHub development repository lacks pre-built libraries of various software components (RTOS, RTOS2). In order to generate a full pack one needs to have the build environment available to build these libraries. This causes some sort of inconvenience. Hence the pre-built libraries may be moved out into separate pack(s) in the future.

To build a complete CMSIS pack for installation the following additional tools are required:

  • doxygen.exe Version: 1.9.6 (Documentation Generator)
  • mscgen.exe Version: 0.20 (Message Sequence Chart Converter)
  • 7z.exe (7-Zip) Version: 16.02 (File Archiver)

Using these tools, you can generate on a Windows PC:

  • CMSIS Documentation using the shell script gen_doc.sh (located in ./CMSIS/Documentation/Doxygen).
  • CMSIS Software Pack using the shell script gen_pack.sh.

License

Arm CMSIS is licensed under License.

Contributions and Pull Requests

Contributions are accepted under License. Only submit contributions where you have authored all of the code.

Issues and Labels

Please feel free to raise an issue on GitHub to report misbehavior (i.e. bugs) or start discussions about enhancements. This is your best way to interact directly with the maintenance team and the community. We encourage you to append implementation suggestions as this helps to decrease the workload of the very limited maintenance team.

We will be monitoring and responding to issues as best we can. Please attempt to avoid filing duplicates of open or closed items when possible. In the spirit of openness we will be tagging issues with the following:

  • bug – We consider this issue to be a bug that will be investigated.
  • wontfix - We appreciate this issue but decided not to change the current behavior.
  • enhancement – Denotes something that will be implemented soon.
  • future - Denotes something not yet schedule for implementation.
  • out-of-scope - We consider this issue loosely related to CMSIS. It might by implemented outside of CMSIS. Let us know about your work.
  • question – We have further questions to this issue. Please review and provide feedback.
  • documentation - This issue is a documentation flaw that will be improved in future.
  • review - This issue is under review. Please be patient.
  • DONE - We consider this issue as resolved - please review and close it. In case of no further activity this issues will be closed after a week.
  • duplicate - This issue is already addressed elsewhere, see comment with provided references.
  • Important Information - We provide essential information regarding planned or resolved major enhancements.

cmsis_6's People

Contributors

0xc0170 avatar alberthuang-cpu avatar bn01mra avatar brondani avatar christophe0606 avatar dependabot[bot] avatar edmundplayer avatar felix-johnny avatar grasci-arm avatar guenthermartin avatar hmogensen-arm avatar jkrech avatar jonatanantoni avatar joseph-yiu avatar keilchris avatar kjbracey avatar mansnils avatar masmiseim36 avatar matthiashertel80 avatar miloradcvjetkovic avatar patater avatar rajszym avatar reinhardkeil avatar robertrostohar avatar robinkastberg avatar spcaipers-arm avatar thorstengerdsmeier avatar ttornblom avatar vladimirumek avatar vovamarch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmsis_6's Issues

Core Armv8 ARM_MPU_SetMemAttrEx include undefined behaviour

__STATIC_INLINE void ARM_MPU_SetMemAttrEx(MPU_Type* mpu, uint8_t idx, uint8_t attr)
{
  const uint8_t reg = idx / 4U;
  const uint32_t pos = ((idx % 4U) * 8U);
  const uint32_t mask = 0xFFU << pos;
  
  if (reg >= (sizeof(mpu->MAIR) / sizeof(mpu->MAIR[0]))) {
    return; // invalid index
  }
  
  mpu->MAIR[reg] = ((mpu->MAIR[reg] & ~mask) | ((attr << pos) & mask));
}

Specifically attr << pos has the potential to shift uint8_t attr greater than its width causing UB

A simple fix would be to promote attr to 32 bit before shifting.

__STATIC_INLINE void ARM_MPU_SetMemAttrEx(MPU_Type* mpu, uint8_t idx, uint8_t attr)
{
  const uint8_t reg = idx / 4U;
  const uint32_t pos = ((idx % 4U) * 8U);
  const uint32_t mask = 0xFFU << pos;
  const uint32_t val = (uint32_t)attr << pos;

  if (reg >= (sizeof(mpu->MAIR) / sizeof(mpu->MAIR[0]))) {
    return; // invalid index
  }

  mpu->MAIR[reg] = (mpu->MAIR[reg] & ~mask) | (val & mask);
}

What is the current status of the CMSIS_6 project?

Hello

I wish to migrate some CMSIS-5 code to CMSIS-6 (mainly since we are moving from armcc to arm clang v6). What is the current status of this project? Is it in alpha/beta or something else? Can it be used in prod code?

CoreDebug_Type no longer defined

CMSIS 5.9 did define CoreDebug_Type that is used by fsl_common.c and therefore affects many NXP projects.

With CMSIS 6.0 this symbol has been renamed to DCB_Type.

There is no information about this renaming and https://learn.arm.com/learning-paths/microcontrollers/project-migration-cmsis-v6/troubleshooting/ does not mention it either. Has there been an impact analysis? How many DFPs depend on CoreDebug_Type?

Test project: https://github.com/Open-CMSIS-Pack/csolution-examples/tree/main/DualCore

Error with 'IRQn_Type' while using with MSPM0L-1306-Q1

I am trying to integrate only CMSIS core in our project that uses MSPM0L-1306-Q1. I have two questions:

  1. What is the include sequence for including the appropriate header files? I am using the header file 'msp.h' that came along as part of the CCS installation. Taking cues from this, I defined DeviceFamily_ID_MSPM0L130X as part of the preprocessor. It was still unable to find references to __disable_irq ,__set_PRIMASK etc so I included <core_cm0plus.h> inside the device specific file explicitly. Is this the correct way to go about it?
  2. After having done that, I am not getting errors of the sort: unknown type name 'IRQn_Type'; . Is CMSIS not supported natively outside the STM32 world? Will I have to modify these files myself?

Where is the CMSIS-SVD.xsd file?

We use the CMSIS-SVD.xsd schema file to dynamically validate our SVD as we edit it (VSCode environment). This file is available under this url from the CMSIS 5 repository. Now that we are migrating to CMSIS 6, we cannot find were this resource has been moved.
Could you help in that matter?
Thanks

False-positive messages from MISRA checkers (for assembly code)

We have got an report that CMSIS/Include/cmsis_gcc.h violates MISRA C-2012 Rule 9.1 with message:
The value of an object with automatic storage duration shall not be read before it has been set.

The code location refers to functions like this:

__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr)
{
   uint32_t result;
 
   __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) );
   return(result);
}

The value of the object result is clearly set, therefore I would consider this as false-positive message from the MISRA checker.

I would appreciate if I can get feedback on these two questions:

  • Does anyone have experience how to deal with this situation in MISRA checkers?
  • Most users may consider the CMSIS Core files as system files and exclude them from checking, but is there a better option?

Thanks
Reinhard

P.S. See also #181

Add features for automatic control

CMSIS does not include a software component with different automatic control techniques.
Is it feasible to add a package with the implementation of the most popular control techniques?

clang system header in gcc headers

Hi,

I am unable to compile due to a warning saying:
Include/cmsis_gcc.h:28: error: ignoring '#pragma clang system_header' [-Werror=unknown-pragmas]

Which is being caused by this bit:

#pragma clang system_header /* treat file as system include file */

Library and toolchain: CMSIS_6 Core library and arm-none-eabi 13.2.1

I think it should be changed to:
#pragma GCC system_header /* treat file as system include file */

Could you please check?

Regards
Amir

CMSIS-Driver USART events expansion

Hello!
I think there is a need to add additional event in driver, "half buffer transfer" event. In NMEA applications it could be extremely helpful, to start parcing while dma continues to receive data. But it seems that currently you get only rx/tx/transfer_complete event.
Thank you!

A bug on IRQHANDLER_T and weak functions?

I have a project where I am trying to add a context pointer to the IRQ handler. There is support for modifying the irq_ctrl_gic.c through the defines and weak functions:
#define IRQ_GIC_EXTERN_IRQ_TABLE
#define IRQHANDLER_T

I've modified the IRQHandler_t to a typedef struct, and also overridden the related weak functions.

typedef void *irqhandler_context_t;
typedef void (*irqhandler_callback_t) (irqhandler_context_t);
typedef struct{
	irqhandler_callback_t callback;
	irqhandler_context_t context;
}IRQHandler_t;

But this gives compile errors. It is because the weak functions are still compiled, but are overridden after. The two weak functions IRQ_Handler() and IRQ_GetHandler() produces "..not a function pointer" and "..conversion to non-scalar type" error. I think the solution is to apply the same fix as applied on the IRQ_Initialize(), so adding in #ifndef:

/// The Interrupt Handler.
__WEAK void IRQ_Handler (void) {
  #ifndef IRQ_GIC_EXTERN_IRQ_TABLE
    IRQn_Type irqn = GIC_AcknowledgePending ();
    if (irqn < (IRQn_Type)IRQ_GIC_LINE_COUNT) {
      IRQTable[irqn]();
    }
    GIC_EndInterrupt (irqn);
  #endif
}

/// Get the registered interrupt handler.
__WEAK IRQHandler_t IRQ_GetHandler (IRQn_ID_t irqn) {
  IRQHandler_t h;
  #ifndef IRQ_GIC_EXTERN_IRQ_TABLE
    // Ignore CPUID field (software generated interrupts)
    irqn &= 0x3FFU;

    if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
      h = IRQTable[irqn];
    } else {
      h = (IRQHandler_t)0;
    }
  #endif
  return (h);
}

Missing file: cmsis_tiarmclang.h

File cmsis_tiarmclang.h is missing. (Assume it's meant to be the m-profile/cmsis_tiarmclang_m.h)
Included from cmsis_compiler.h:

/*
 * TI Arm Clang Compiler (tiarmclang)
 */
#elif defined (__ti__)
  #include "cmsis_tiarmclang.h"

Sign conversion warnings

When using gcc 11.3 & 12.3, there are sign conversion warnings in armv7m_cachel1.h with most usages of __SCB_DCACHE_LINE_SIZE and __SCB_ICACHE_LINE_SIZE in that file.

Differentiating between CM33 and CM85 with preprocessor

In a previous issue submitted to CMSIS 5, I was told that it was no longer advisable to use the arch defines like __ARM_ARCH_8M_MAIN__ and to instead use __ARM_ARCH.

But dumping preprocessor defines for CM33 and CM85 both yield the same __ARM_ARCH* defines:

// Using GCC 13.2
#define __ARM_ARCH 8
#define __ARM_ARCH_8M_MAIN__ 1
#define __ARM_ARCH_EXT_IDIV__ 1
#define __ARM_ARCH_ISA_THUMB 2
#define __ARM_ARCH_PROFILE 77

Note that GCC generates __ARM_ARCH_8M_MAIN__ for both CM33 and CM85.

LLVM 17 generates the same as GCC, with the exception that it generates __ARM_ARCH_8_1M_MAIN__ for CM85.

How should CM33 and CM85 be differentiated with the preprocessor?

warning: "__ARM_FP" is not defined

With the new CMSIS 6.0.0 I get this warning when compiling with GCC with soft float:
CMSIS/include/m-profile/cmsis_gcc_m.h:1535:6: warning: "__ARM_FP" is not defined, evaluates to 0 [-Wundef]

As far as I know __ARM_FP is only defined if hard float is used.
core_cm4.h checks if it is defined #if defined (__ARM_FP) but in two places in cmsis_gcc_m.h __ARM_FP is used without checking if it is defined. For example:

__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr)
{
#if (__ARM_FP >= 1)
  __builtin_arm_set_fpscr(fpscr);
#else
  (void)fpscr;
#endif
}

I consider this a bug since this generates a lot of warnings (if not suppressed). (This applies to all compilers and architectures.)

missing defined (__ARM_FEATURE_CMSE) in some cases

Hi
most check for __ARM_FEATURE_CMSE are like this
defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
but in some lines are only
(__ARM_FEATURE_CMSE < 3U)
so my tools reporting, that __ARM_FEATURE_CMSE can be undefined and interpreting as 0

please add everywhere a defined (__ARM_FEATURE_CMSE)

compare cmsis_armclang.h with cmsis_gcc.h

Extra '(' to be removed

There's an extra '(' at line 621 in cmsis_iccarm_m.h file.

  #if !((defined (__ARM_FP)      && (__ARM_FP >= 1)) 
    #undef __get_FPSCR
    #undef __set_FPSCR
    #define __get_FPSCR()       (0)
    #define __set_FPSCR(VALUE)  ((void)VALUE)
  #endif

CoreDebug_Type no longer defined

CMSIS 5.9 did define CoreDebug_Type.
CMSIS 6.0 replaces this by DCB_Type.

NXP is using this symbol in their DFPs (file fsl_common_arm.c). Has there been an impact analysis? How many DFPs are affected?

https://learn.arm.com/learning-paths/microcontrollers/project-migration-cmsis-v6/troubleshooting/ does not mention that problem.

CMSIS-Core history does also not cover details. The reference to 'TRM' is a bit cryptic.

Example Project: https://github.com/Open-CMSIS-Pack/csolution-examples/tree/main/DualCore

Add HOST support

CMSIS should contain an ANSI C compatible core header (e.g. cmsis_none.h or cmsis_ansci.h) which can be compiled on any major platform without anything vendor specific. In the spirit of the "HOST build" of CMSIS-DSP which uses the none.h header to compile the DSP library on e.g. x86 we should have the same option available for just CMSIS.

The problem is that nowadays most "HAL libraries" of ARM silicon vendors rely on CMSIS headers as a lower layer and while one could easily stub (and or mock) some C functions which use memory mapped structs for peripherals and so on it's actually really hard to replace the underlying CMSIS headers.

My personal approach would be

  • What can be replaced with a meaningful implementation (e.g. __QADD) should be.
  • What can't should simply be a NOP.

/edit
Once such a header exists CMSIS-DSP could have a dependency to CMSIS and use this header, instead of defining things like __QADD itself.

Cortex-R5 and Cortex-R5F

What about the core Cortex-R5F ? Are they planned to be included in the CMSIS-6 and CMSIS-DSP ?

Provide a compile-time version information about API version

Some of the CMSIS drivers already provide compile-time version information, for example USART driver provides a macro with name ARM_USART_API_VERSION.

There are, however, some APIs like CMSIS RTOS2 or VIO driver API which don't provide compile-time version information.

Could all APIs have compile-time version information available.

Maybe this should be addressed on a tooling level as requested by Open-CMSIS-Pack/devtools#1154

Unknown pragma when compiling with GCC

I pulled down the latest dev drop today.

It appears there is a clang pragma in cmsis_gcc_m.h (maybe others too) that generates a build error.
image

If I delete this line, then it builds fine

ac6_linker_script.sct.pp: No such file or directory

how to fix it when i excute "./build.py -c AC6 -d CM85 -o none build run "

Fatal error: L6031U: Could not open scatter description file /home/ubuntu/new/CMSIS_6-main/CMSIS/CoreValidation/Project/build/CM85/AC6/none/Validation/intdir/ac6_linker_script.sct.pp: No such file or directory
Finished: 0 information, 0 warning, 0 error and 1 fatal error messages.
ninja: build stopped: subcommand failed.
error cbuild: error executing 'cmake' build
error cbuild: error processing 'build/CM85/AC6/none/Validation/Validation.none+CM85.cprj'
error cbuild: exit status 1

inline compilation error with cmsis_armclang.h and C90 language

In the latest cmsis_armclang.h, we have:
#define __INLINE inline

However, "inline" is a valid keyword only from C99 language.
For C90, ARM compiler v6 recognizes only __inline or inline keywords.

Additional remark: the @Date of the file is "27. July 2024" while it was committed in February 2024

const-qualify variable to suppress compiler warning

I get a warning/suggestion from the compiler because in the following function
https://github.com/ARM-software/CMSIS_5/blob/a75f01746df18bb5b929dfb8dc6c9407fac3a0f3/CMSIS/Core/Include/core_cm7.h#L2195-L2199

in the line

  uint32_t *vectors = (uint32_t *)SCB->VTOR;

the pointer vectors can/should be defines as pointer-to-const

  const uint32_t *vectors = (const uint32_t *)SCB->VTOR;

I think that the same change can be applied to all the other core_cmXXX.h files

CMSIS API to obtain fine grained caching information

Hello

I have been looking around CMSIS APIs to obtain fine grained information about caching. I am specifically looking at the MSMP0 (Arm Cortex M0, v6 arch) family of MCUs so I may be biased in that direction. What I am looking for is the kind of information available from Texas Instrument's DriverLib function 'DL_CORE_getInstructionConfig'.

As of now I couldn't find anything that will return instruction caching, prefetch, and 'literal cache' configuration. I looked at "MPU functions for Armv6-M/v7-M" as well as Cache functions [Level-1] but nothing maps to what I need. Is there something that I can use as a sort of a workaround or perhaps I'm missing something here? Perhaps we need more than a single function to get to this information?

In CoreValidation - improper use of #ifdef's

When creating CMake scripts to include the CoreValidation as a target, and adding in CV_CML1Cache.c

The #ifdef __ICACHE_PRESENT is improperly used - it should be #if defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1)

Same goes for __DCACHE_PRESENT

Please update.

Unterminated #ifndef in core_cm55.h

When including core_cm55.h from the latest CMSIS_6, I get a preprocessing error:

CMSIS_6/CMSIS/Core/Include/core_cm55.h:210: error: unterminated #ifndef
  210 | #ifndef __CMSIS_GENERIC

Looks like the root cause is actually a duplicate opening #ifndef CMSIS_DISABLE_DEPRECATED on line 3613:

#ifndef CMSIS_DISABLE_DEPRECATED

#ifndef CMSIS_DISABLE_DEPRECATED

And core_sc300.h has the same issue.

__ARM_ARCH_8_1M_MAIN__ is not documented

I believe that with ArmV8.1M a new macro has been added to CMSIS: __ARM_ARCH_8_1M_MAIN__ . This is not covered in the current documentation.

Also the value of __ARM_ARCH_8M_xxxx seems to be compiler dependent as CMSIS only defines fallbacks. Maybe this is worth a note. See also the problem described in #159

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.