interrupt

Jumping from one firmware to another in MCU internal FLASH

一曲冷凌霜 提交于 2019-11-30 16:05:13
I am currently working on a bootloader firmware application targeted to STM32F030C8. I specified in my scatter file that the bootloader app will occupy main memory location 0x08000000 to 0x08002FFF (sector 0 to sector 2). I also wrote a main firmware application that is stored from 0x08003000 to 0x0800C800. After downloading both firmware to the MCU internal FLASH, I lauched the main app from the bootloader using the code below: /************************************************************//** * \brief Start the main application if available and correct ****************************************

Disable Hardware & Software Interrupts

帅比萌擦擦* 提交于 2019-11-30 14:57:35
Is it possible to disable all interrupts with a ASM/C/C++ program to get full control about the processor? If yes -> how? If not -> how do "atomic" operation system calls work (for example entering a critical section)? Thanks for your help! Ludwig Weinzierl In x86 assembly the the commands are sti set interrupt enable bit cli clear interrupt enable bit These commands set and clear the IF Flag . When the IF flag is set, the CPU will handle hardware interrupts, and when it is clear the CPU will ignore hardware interrupts. It does not affect the handling of non-maskable interrupts though, nor

On x86, when the OS disables interrupts, do they vanish, or do they queue and 'wait' for interrupts to come back on?

喜夏-厌秋 提交于 2019-11-30 11:42:40
My platform is x86 and x86-64, on Windows. The point of the interrupt priority system is to have the highest priority interrupt beat out the others. To enforce this, I'm guessing that Windows will disable all interrupts of lower level completely, until the ISR for the higher-level interrupt is complete. But if the CPU isn't listening to interrupts, what happens? Do they just silently disappear? Or are they queued in hardware, waiting for interrupts to become enabled again? If they are stored, where? Are there limitations to how many can queue up? What happens if too many interrupts go

Why disabling interrupts disables kernel preemption and how spin lock disables preemption

放肆的年华 提交于 2019-11-30 11:31:11
问题 I am reading Linux Kernel Development recently, and I have a few questions related to disabling preemption. In the "Interrupt Control" section of chapter 7, it says: Moreover, disabling interrupts also disables kernel preemption. I also read from the book that kernel preemption can occur in the follow cases: When an interrupt handler exits, before returning to kernel-space. When kernel code becomes preemptible again. If a task in the kernel explicitly calls schedule() If a task in ther kernel

Which context are softirq and tasklet in?

回眸只為那壹抹淺笑 提交于 2019-11-30 10:48:52
问题 I know that there are process context and interrupt context but I don't understand when executing softirq or tasklet, which context is it run under. I have seen some people use the term "bottom-halves context", if there's such term, what's the difference comparing with the others. Another question to softirq and tasklet is that why sleep are not allowed during execution?? Can anyone help me identify these questions, thanks!! 回答1: The softirq and tasklet are both kind of bottom-halves

How to run one last function before getting killed in Python?

天涯浪子 提交于 2019-11-30 06:35:31
Is there any way to run one last command before a running Python script is stopped by being killed by some other script, keyboard interrupt etc. import time try: time.sleep(10) finally: print "clean up" clean up Traceback (most recent call last): File "<stdin>", line 2, in <module> KeyboardInterrupt If you need to catch other OS level interrupts, look at the signal module: http://docs.python.org/library/signal.html Signal Example from signal import * import sys, time def clean(*args): print "clean me" sys.exit(0) for sig in (SIGABRT, SIGBREAK, SIGILL, SIGINT, SIGSEGV, SIGTERM): signal(sig,

Arduino Serial Interrupts

只谈情不闲聊 提交于 2019-11-30 05:39:37
问题 I am working on an Arduino Mega 2560 project. At a Windows 7 PC I am using the Arduino1.0 IDE. I need to establish a serial Bluetooth communication with a baud rate of 115200. I need to receive an interrupt when data is available at RX. Every piece of code I have seen use “polling”, which is placing a condition of Serial.available inside Arduino’s loop. How can I replace this approach at Arduino’s loop for an Interrupt and its Service Routine? It seems that attachInterrupt() does not provides

ARM Cortex M3 How do I determine the program counter value before a hard fault?

不羁的心 提交于 2019-11-30 05:27:16
I have an embedded project using a STM32F103 (ARM Cortex M3), it is getting a occasionally getting hard fault in release mode. As part of recovery, I would like to retrieve the PC value from before the hard fault and store it for later debugging in the battery backed region. How would I determine the value of the program counter at the point of the hard fault? Obviously, the PC is now set to its location within the hardfault interrupt. Where should I look? It there an address for the normal mode register bank? Thanks! Cortex-M3 uses a quite different model of exception handling from the

When and how are system calls interrupted?

扶醉桌前 提交于 2019-11-30 04:53:15
This is a followup question to Is a successful send() "atomic"? , as I think it actually concerns system calls in general, not just sends on sockets. Which system calls can be interrupted, and when they are, where is the interruption handled? I've learned about SA_RESTART, but don't exactly understand what is going on. If I make a system call without SA_RESTART, can the call be interrupted by any kind of interrupts (e.g. user input) that don't concern my application, but require the OS to abort my call and do something else? Or is it only interrupted by signals that directly concern my process

What are the differences between calling System.exit(0) and Thread.currentThread().interrupt() in the main thread of a Java program?

浪尽此生 提交于 2019-11-30 03:42:48
Both cause a program to stop executing. It's clear that there must be some differences in how this happens, though. What are they? Summary thread.interrupt() does not stop a thread. It is used for coordination in multi-threaded programs. Don't use it unless you know exactly what you do. Throwing a RuntimeException will (usually) terminate the thread but not necessarily the program. System.exit(int) almost always terminates the program and returns a status code. In unusual situations, System.exit(int) might not actually stop the program. Runtime.getRuntime().halt(int) on the other hand, always