Electronics > Microcontrollers

Does anyone have experience debugging CMSIS-DAP firmware itself?

<< < (20/20)

ataradov:
Non-TZ stuff is virtually the same. Anyone familiar with regular Cortex-Mx devices would find it easy to use.

TZ is nuts. It wrecks all the standard C compatibility that they worked hard to achieve. I guess technically you still code in C, but now they just forced compilers to support their garbage instead of adapting to the existing compilers. This makes the whole thing painful and awkward to use. With no real (non-marketing) benefits.

technix:

--- Quote from: ataradov on May 18, 2021, 02:44:41 am ---TZ is nuts. It wrecks all the standard C compatibility that they worked hard to achieve. I guess technically you still code in C, but now they just forced compilers to support their garbage instead of adapting to the existing compilers. This makes the whole thing painful and awkward to use. With no real (non-marketing) benefits.

--- End quote ---
Hmm I need more details on this...

ataradov:
Read about "-mcmse" flag and relevant linker flags. With TZ you need to separate your program into secure and non-secure parts. And then half your functions becomes littered with attributes like "__attribute__((cmse_nonsecure_entry))".

Here is a random article that shows a summary of what is going on - https://www.lobaro.com/using-the-armv8-m-trustzone-with-gcc/

Here is a sample code from there:

--- Code: ---// some c file of secure firmware project defining veneer gateway functions
// must compiled with -mcmse gcc flag (!)
#include "arm_cmse.h"
typedef void (*funcptr_ns) (void) __attribute__((cmse_nonsecure_call));
void ControlCriticalIO(funcptr_ns callback_fn) __attribute__((cmse_nonsecure_entry)){
 funcptr_ns cb = callback_fn; // save volatile pointer from non-secure code
 
 // check if given pointer to non-secure memory is actually non-secure as expected
 cb = cmse_check_address_range(cb, sizeof(cb), CMSE_NONSECURE);
 
 if (cb != 0) {
    /* do some critical things e.g. use other secure functions */
    cb(); // invoke non-secure call back function
 }else {
   // do nothing if pointer is incorrect
 }
}

--- End code ---

If anyone for a seconds thinks this is "C", they are as nuts as people that engineered that.

And interestingly, STM made an implementation of the same exact thing using external wrapper to the standard core. It is way cleaner and easier to use than this BS. ARM lost the plot here.

And yes, you generally build your program from two completely different binaries - secure and non-secure. Debugging this mess is tricky to put it mildly.

technix:

--- Quote from: ataradov on May 18, 2021, 04:09:25 am ---Read about "-mcmse" flag and relevant linker flags. With TZ you need to separate your program into secure and non-secure parts. And then half your functions becomes littered with attributes like "__attribute__((cmse_nonsecure_entry))".

[snip]

If anyone for a seconds thinks this is "C", they are as nuts as people that engineered that.

And interestingly, STM made an implementation of the same exact thing using external wrapper to the standard core. It is way cleaner and easier to use than this BS. ARM lost the plot here.

And yes, you generally build your program from two completely different binaries - secure and non-secure. Debugging this mess is tricky to put it mildly.

--- End quote ---
Understood. If this is the case I think I will be putting SAML11 on infinite hold until ARM can get their sh!t together.

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version