embedded

Interrupt-safe way to set function pointer in HiTech C on PIC32

橙三吉。 提交于 2019-12-06 06:17:18
I have an ISR defined to trigger on an external interrupt. The external interrupt may not always be enabled, but under certain circumstances I want to be able to register a function to be called ONCE within the interrupt from within the main code. The function might be replaced by another one, or removed, before the next interrupt. I don't know much about techniques for synchronisation on the PIC32, but I've come up with the following: volatile BOOL callbackInterrupted = FALSE; volatile BOOL callbackWritten = FALSE; void (*myCallback)() = NULL; void RegisterCallback(void (*callback)()) { do {

How to write a CanOpen stack?

限于喜欢 提交于 2019-12-06 06:15:24
I have a similar problem with this. How to program a simple CANopen layer . I read the answers but I have to program a CANopen layer on my own I cannot get a commercial one. So are there any basics of writing a CANopen stack (or layer I'm not certain about the difference)? I don't know even where to start.. If it's required here's some information : My master device is a beagle bone black with QNX. QNX has a generic CAN library I think but not specific to CANopen. And my slave is a militarized brushless motor controller. I'm writing in C++. I have a documentation about the general requirements

Using <chrono> as a timer in bare-metal microcontroller?

前提是你 提交于 2019-12-06 06:09:53
问题 Can chrono be used as a timer/counter in a bare-metal microcontroller (e.g. MSP432 running an RTOS)? Can the high_resolution_clock (and other APIs in chrono) be configured so that it increments based on the given microcontroller's actual timer tick/register? The Real-Time C++ book (section 16.5) seems to suggest this is possible, but I haven't found any examples of this being applied, especially within bare-metal microcontrollers. How could this be implemented? Would this be even recommended?

Windows Embedded 8 Handheld (WE8H) Supported Devices

狂风中的少年 提交于 2019-12-06 05:25:10
问题 Needed to find a way to create a "Kiosk mode" Windows 8 phone Application. After one and a half weeks of google intensive search, i've realized it is not possible to do. Then - Found two ways to workaround the problem - Kid's Corner. Windows 8 Embedded Handheld o.s. The second solution looks better to me. i've found the Windows 8 Embedded Handheld SDK, and now i have the ability to start coding. but, one second before i start, i couldn't find any device who supports this o.s (?!?) does some

RS232 (UART) on STM32F4-Discovery (STM32F429ZIT6) with HAL library?

主宰稳场 提交于 2019-12-06 05:23:14
问题 Background Here is some of my background so that your guy could know what related knowledge I have or I don't have. I'm totally a newbie of this kind of embedded system. And I don't really know anything about electronics, I'm a pure software guy. My only experience of embedded system is Raspberry Pi, which is quite different from STM32F4 Discovery. I could implement a UART read / write programming by using standard Linux C library on Raspberry Pi, which is connected to a PC with an USB-to

How to properly set up serial communication on Linux

馋奶兔 提交于 2019-12-06 04:08:10
问题 I'm attempting to read and write data from and to an FPGA board. The board itself came with a driver that create a terminal device called ttyUSB0 whenever the board is plugged in. On the FPGA, an asynchronous receiver and transmitter were implemented, and they seem to work. However, there seems to be an issue on C side of things. I've been using some test vectors to test if the FPGA is outputting the proper information. I've noticed a few things things: The device sometimes does not open

ARM cortex: mutex using bit banding

与世无争的帅哥 提交于 2019-12-06 04:01:17
问题 Given that, on the ARM Cortex M3, I can: atomically read a single bit atomically set a single bit atomically clear a single bit How can I combine these for a mutex style set of operations: try lock take lock release lock It seems that try_lock or take_lock would require two operations that would not be atomic. Do I need more control to accomplish this? Disable global interrupts would do it but it seems there should be a more surgical approach. 回答1: Your rwl_TryLock() doesn't necessarily

What is overalignment of execution regions and input sections?

戏子无情 提交于 2019-12-06 02:05:12
问题 I came across code similar to the following today and I am curious as to what is actually happening: #pragma pack(1) __align(2) static unsigned char multi_array[7][24] = { 0 }; __align(2) static unsigned char another_multi_array[7][24] = { 0 }; #pragma pack() When searching for a reference to the __align keyword in the Keil compiler, I came across this: Overalignment of execution regions and input sections There are situations when you want to overalign code and data sections... If you have

Detect Stack overflows

我是研究僧i 提交于 2019-12-06 01:54:27
问题 How do operating systems detect stack overflows of user-space programs [and then send SIGTERM or SIGSEGV to those userspace programs] ? 回答1: The answer will depend on the target architecture and the particular OS. Since the question is tagged Linux, you have rather biased the question which on the face of it seems more general. In a sophisticated OS or RTOS such as Linux or QNX Neutrino, with MMU protection support, memory protection mechanisms may be used such as the guard pages already

Put gcc libs .data in specific section?

只谈情不闲聊 提交于 2019-12-06 01:47:39
I'm trying to switch to the GNU GCC compiler for our embedded system, but I'm having trouble linking the project as the memory layout of our chip is split: RAM section 1: 0x10000-0x12FFF RAM section 2: 0x18000-0x1BFFF The data from our project can fit in section 1, but the data linked from the gcc libs doesn't. Map file extract: .data 0x00012974 0x3c4 c:/tools/gnucr16_v1.1.3-elf/cr16-elf/bin/../lib/gcc/cr16-elf/4.5.1-GNUCR16_v1.1.3/../../../../cr16-elf/lib\libc.a(lib_a-impure.o) 0x00012974 _impure_ptr .data 0x00012d7c 0x410 c:/tools/gnucr16_v1.1.3-elf/cr16-elf/bin/../lib/gcc/cr16-elf/4.5.1