cortex-m3

Difference between .equ and .word in ARM Assembly?

ぐ巨炮叔叔 提交于 2019-12-03 20:10:43
问题 I am curious - What is the difference between .equ and .word directives in ARM assembly, when defining constants? 回答1: .equ is like #define in C: #define bob 10 .equ bob, 10 .word is like unsigned int in C: unsigned int ted; ted: .word 0 Or initialized with a value: unsigned int alice = 42; alice: .word 42 回答2: .word is a directive that allocates a word-sized amount of storage space (memory) in that location. It can additionally have that location initialized with a given value. .equ is more

Add a custom compiler to XCode 3.2

不想你离开。 提交于 2019-12-03 13:37:20
I have a working gcc 4.3.3 toolchain for an ARM Cortex-m3 and would like to integrate it into XCode. Is there a way to set up XCode (3.2) to use this gcc toolchain instead of the built-in GCC 4.2? What I've tried so far: I've added a modified copy of the GCC 4.2.xcplugin and changed the name, version and executable path. It shows up in XCode but whenever I set the "C/C++ Compiler Version" to the custom compiler it fails with Invalid value '4.3.3' for GCC_VERSION It seems like the valid version numbers are hardcoded somewhere else because even when I remove the original GCC 4.2.xcplugin , the

ARM cortex-M3 uint_fast32_t vs uint32_t

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am developing a program for an STM32Fx cortex-M3 series processor. In stdint.h the following are defined: typedef unsigned int uint_fast32_t; typedef uint32_t uint_least32_t; typedef unsigned long uint32_t; As I understand it. [u]int_fast[n]_t will give you the fastest data type of at least n bits. [u]int_least[n]_t will give you the smallest data type of at least n bits. [u]int[n]_t will give you the data type of exactly n bits. Also as far as i know sizeof(unsigned int) <= sizeof(unsigned long) and UINT_MAX <= ULONG_MAX - always. Thus I

ARM Cortex-M3 Startup Code

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to understand how the initialization code works that ships with Keil (realview v4) for the STM32 microcontrollers. Specifically, I'm trying to understand how the stack is initialized. In the documentation on ARM's website it mentions that one of the routines in startup_xxx.s, __user_initial_stack_heap , should not use more than 88 bytes of stack. Do you know where that limitation is coming from? It seems that when the reset handler calls System_Init it is executing a couple functions in a C environment which I believe means it is

ARM M4 Instructions per Cycle (IPC) counters

半腔热情 提交于 2019-12-03 01:11:46
I would like to count the number of Instructions per Cycle executed on an ARM cortex-M4 (or cortex-M3) processor. What it's needed is: number of instructions (executed at runtime) of the code I want to profile and number of cycles that the code takes to execute. 1 - Number of Cycles Use the cycle counter is quite easy and straightforward. volatile unsigned int *DWT_CYCCNT ; volatile unsigned int *DWT_CONTROL ; volatile unsigned int *SCB_DEMCR ; void reset_timer(){ DWT_CYCCNT = (int *)0xE0001004; //address of the register DWT_CONTROL = (int *)0xE0001000; //address of the register SCB_DEMCR =

Using newlib's malloc in an ARM Cortex-M3

China☆狼群 提交于 2019-12-02 16:22:30
I'm creating code for an ARM Cortex-M3 (NXP's LCP17xx). I've been using static memory up to now and everything worked well. I tried to add dynamic memory support, but once I call malloc, the system gets stuck. I'm compiling with gcc for arm bare metal, and using newlib. Version: gcc-arm-none-eabi-4_6-2012q1 To add malloc support, I implemented a simple _sbrk function and modified my linker script to make some space for the heap (I've read many different tutorials about this part, but none cover the problem that I encountered next). With the help of some leds, I can be certain that the code

Indirect function call uses odd address

自古美人都是妖i 提交于 2019-12-02 01:59:49
问题 When the GCC 4.7.3 (20121207) for ARM Cortex-M3 takes the address of a function it doesn't get the exact address of the function. I can see an off-by-one in that pointer. // assume at address 0x00001204; int foo() { return 42; } void bar() { int(*p)() = &foo; // p = 0x1205; p(); // executed successfully foo(); // assembly: "bl 0x00001204;" } Although the pointer points to an odd address, the execution is successful. I would expect an exception at this point. Why does it takes that strange

Safely detect, if function is called from an ISR?

北战南征 提交于 2019-12-01 15:46:39
I'm developing software for an ARM Cortex M3 (NXP LPC1769) microncontroller. At the moment I'm searching for a mechansim to detect if my function is called within an ISR. I asume that I have to check a register. Based on this information I would like to call difficult functions. I already checked the reference manual, if there is a register containing the necessary information. For example I tried to detect if I'm called from an ISR (I used SysTick-ISR) based on the "Interrupt Active Bit Register" (IABR) register. This register should be != 0 if an ISR is active. But the value was 0x00000000.

On core_cm4.h why is there casting like ((uint32_t)(int32_t)IRQn)?

廉价感情. 提交于 2019-12-01 09:22:45
In the following code from core_cm4.h why is there a double cast ((uint32_t)(int32_t)IRQn) ? For example in the following function: __STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) { NVIC->ISER[(((uint32_t)(int32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); } What is the purpose of this? Since CM4 software implements negative interrupt sources for core, you have to cast value first to 32bit signed integer and later to unsigned 32bit to make proper right shift with padding zeros on the left side of number. CM4 uses -15 to -1 as CM4-Core sources and from 0 to

Eclipse GDB “init” and “run” settings for ARM LPC1768 using OpenOCD?

◇◆丶佛笑我妖孽 提交于 2019-12-01 08:28:54
I finally figured out how to get code running on this LPC1768 mini board , however now I'm trying to get debugging working. The toolchain I'm using is: Yagarto + Eclipse (Indigo) (w/ GDB Hardware Debugger) + OpenOCD . My JTAG interface is: Bus Blaster V2 board. I found one guide that walks through a similar setup, but it's for a different JTAG interface so not very useful. There's also this post regarding an LPC1768 example , but the gdb commands aren't for OpenOCD. At this point the only command I know for sure (for init) is target remote localhost:3333 (for connecting to the OpenOCD gdb