cortex-m

LPC4088 checksum value for Thumb?

余生颓废 提交于 2019-12-08 05:23:19
问题 In the LPC4088 user manual (p. 876) we can read that LPC4088 microcontroler has a really extraordinary startup procedure: This looks like a total nonsense and I need someone to help me clear things out... In the world of ARM I've heard countless times to put vector table looking like this: reset: b _start undefined: b undefined software_interrupt: b software_interrupt prefetch_abort: b prefetch_abort data_abort: b data_abort nop interrupt_request: b interrupt_request fast_interrupt_request: b

Write a simple C arbitrary code execution exploit on ARM Cortex-M3?

混江龙づ霸主 提交于 2019-12-07 04:40:57
问题 I'm trying to write a proof of concept in C that demonstrates code execution from a memory buffer in the stack on an ARM Cortex-M3. This will be useful to demonstrate that using the ARM MPU correctly can prevent such an attack. I figured a quick and dirty way to get some code into the stack is to copy it from a regular function and then use a goto to jump to it like so: static void loopit(void) { printf("loopit\n"); while (1); } void attack(void) { uint8_t buffer[64] __attribute__((aligned(4)

DSP libraries - RFFT - strange results

放肆的年华 提交于 2019-12-06 08:26:03
Recently I've been trying to do FFT calculations on my STM32F4-Discovery evaluation board then send it to PC. I have looked into my problem - I think that I'm doing something wrong with FFT functions provided by manufacturer. I'm using CMSIS-DSP libraries. For now I've have been generating samples with code (if that works correct I'll do sampling by microphone). I'm using arm_rfft_fast_f32 as my data are going to be floats in the future, but results I get in my output array are insane (I think) - I'm getting frequencies below 0. number_of_samples = 512; (l_probek in code) dt = 1/freq/number_of

When is CLREX actually needed on ARM Cortex M7?

一个人想着一个人 提交于 2019-12-06 06:21:34
问题 I found a couple of places online which state that CLREX "must" be called whenever an interrupt routine is entered, which I don't understand. The docs for CLREX state (added the numbering for easier reference): (1) Clears the local record of the executing processor that an address has had a request for an exclusive access. (2) Use the CLREX instruction to return a closely-coupled exclusive access monitor to its open-access state. This removes the requirement for a dummy store to memory. (3)

arm sleep mode entry and exit differences WFE, WFI

a 夏天 提交于 2019-12-05 19:01:48
问题 I am reasonably new to the ARM architectures and I am trying to wrap my head around the wake up mechanism. So first of all I am finding it difficult to find good info on this. ARM's documentation seems to be very terse on the topic. What I'd like to understand is when the Cortex (particularly the M0 as that's what I am working with) will wake up. For reference, I have also consulted the following: What is the purpose of WFI and WFE instructions and the event signals? Why does the processor

Write a simple C arbitrary code execution exploit on ARM Cortex-M3?

青春壹個敷衍的年華 提交于 2019-12-05 10:16:23
I'm trying to write a proof of concept in C that demonstrates code execution from a memory buffer in the stack on an ARM Cortex-M3. This will be useful to demonstrate that using the ARM MPU correctly can prevent such an attack. I figured a quick and dirty way to get some code into the stack is to copy it from a regular function and then use a goto to jump to it like so: static void loopit(void) { printf("loopit\n"); while (1); } void attack(void) { uint8_t buffer[64] __attribute__((aligned(4))); memcpy(buffer, loopit, sizeof(buffer)); goto *((void *) (int) buffer); } I would expect that when I

STM32F0 System Clock PLL configuration and/or temperature causing error?

半腔热情 提交于 2019-12-04 19:43:21
My project has started experiencing a problem in which the SysTick rate is usually, but not always set too fast. I have not changed the code that is relevant, and it seems to be temperature-related. I am using an STM32F072B-DISCOVERY board, with VisualGDB on Visual Studio Community 2015. My initialization code includes the following function: void Setup_Init_Clocks() { // Set up 48 MHz Core Clock using HSI (8Mhz) with PLL x 6 RCC_PLLConfig(RCC_PLLSource_HSI, RCC_PLLMul_6); RCC_PLLCmd(ENABLE); // Wait for PLLRDY after enabling PLL. while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) != SET) { } RCC

When is CLREX actually needed on ARM Cortex M7?

不问归期 提交于 2019-12-04 15:43:23
I found a couple of places online which state that CLREX "must" be called whenever an interrupt routine is entered, which I don't understand. The docs for CLREX state (added the numbering for easier reference): (1) Clears the local record of the executing processor that an address has had a request for an exclusive access. (2) Use the CLREX instruction to return a closely-coupled exclusive access monitor to its open-access state. This removes the requirement for a dummy store to memory. (3) It is implementation-defined whether CLREX also clears the global record of the executing processor that

Retrieving return address of an exception on ARM Cortex M0

让人想犯罪 __ 提交于 2019-12-04 10:12:48
I am trying to retrieve the return address of an IRQ handler in my code. My aim is to save the value of the PC just before the watchdog timer expires and before the reset for debug purposes, using WDT_IRQHandler(). I am also testing this approach with other IRQs to check if I grasped the idea. But it seems I haven't. I have read the documentation available. I understood that when an exception happens, 8 registers are pushed to the stack: R0, R1, R2, R3, R12, LR, PC and XPSR. I have also read that the stack is automatically double word aligned. So in my mind, retrieving the return address is as

GDB Monitor commands in CLion

旧时模样 提交于 2019-12-04 06:47:21
I'm trying to debug an embedded project using remote GDB. My system: Target: ARM Cortex M0. SEGGER J-Link GDB Server V6.10 Command Line Version arm-none-eabi-gdb 7.10.1.20160616-cvs CLion 2016.2.2, Build #CL-162.1967.7 Ubuntu 16.04 I have the following in my .gdbinit file: target remote localhost:2331 #(I remove this line when debugging with CLion) set verbose on file "/path_to_output_file/blinky.elf" monitor reset break main The thing that has troubled me for days now, is that this works fine if I debug with gdb directly from a terminal, but not when I use the debugger in CLion. In CLion I