2010-09-16 8 views
7

Estoy buscando una forma de determinar si un procesador ARM está arrancando desde un arranque en frío (es decir, encendido inicial) en comparación con un arranque en caliente (es decir, una afirmación de reinicio sin pérdida de potencia real). Específicamente, estoy usando un núcleo ARM968, haré la determinación usando C o ensamblaje, y usaré la determinación para que ciertas operaciones solo se ejecuten en el encendido inicial y no en restablecimientos posteriores. En proyectos anteriores, aproveché los circuitos externos (por ejemplo, FPGA) para detectar los diferentes escenarios de arranque, pero en este caso estoy limitado al núcleo de ARM.¿Cómo detectar el arranque en frío frente al inicio en caliente en un procesador ARM?

Respuesta

5

Puede inicializar una variable global en la RAM a un valor que es improbable durante el arranque en frío y verificarlo durante el arranque.

Para los microcontroladores, normalmente, la lógica de reinicio del chip específico proporciona un registro de estado, que indica la fuente del restablecimiento. No sé si eso existe para este núcleo más grande, y si podrías usar eso.

+4

La memoria RAM puede contener valores durante un tiempo sorprendentemente largo después del apagado. – caf

+1

El enfoque de la variable RAM funcionó. Seccioné una porción de 4 bytes de SRAM para una firma de inicio y la excluí del tamaño de SRAM en las directivas de vinculador, por lo que nada se inicializaría ni sobrescribiría, excepto el código de escritura/verificación de firma. –

2

Es probable que sea difícil, y tal vez no se refiera realmente al núcleo mismo. El núcleo debería haber obtenido un restablecimiento, pero la memoria del exterior (pero quizás todavía dentro del chip) no lo hizo. si la memoria está basada dram, entonces aún puede borrarse en el arranque. No sé de una respuesta genérica de talla única. Sin embargo, tanto tú como Starblue lo tienen, tienes que buscar un registro en algún lugar que no esté borrado en un restablecimiento, configurarlo para algo que "probablemente" no ocurra al azar en un encendido. léelo y luego configúralo. piensa que los fpga o los pld que administran la lógica de reinicio en el nivel de la placa (si hay alguno) son los mejores porque en un restablecimiento de encendido también se reinician, y en un reinicio en caliente son los que lo causaron y mantienen su estado .

explore el TRM para su núcleo oa través de la especificación de registro del chip, y vea si hay registros cuyo estado de restablecimiento no está definido, uno que normalmente no usa y que no dañará el chip si lo configura en algo , y ver a qué se debe eso, ahí es donde empezaría a buscar.

10

Compruebe los documentos para su chip específico ("ARM968" no es lo suficientemente específico). Debería haber un registro que describa la causa del reinicio. P.ej. esto es lo que LPC23xx tiene:

Reset Source Identification Register (RSIR - 0xE01FC180) 

This register contains one bit for each source of Reset. Writing a 1 to any of these bits 
clears the corresponding read-side bit to 0. The interactions among the four sources are 
described below. 

Bit Symbol Description 
0 POR Assertion of the POR signal sets this bit, and clears all of the other bits in 
this register. But if another Reset signal (e.g., External Reset) remains 
asserted after the POR signal is negated, then its bit is set. This bit is not 
affected by any of the other sources of Reset. 
1 EXTR Assertion of the RESET signal sets this bit. This bit is cleared by POR, 
but is not affected by WDT or BOD reset. 
2 WDTR This bit is set when the Watchdog Timer times out and the WDTRESET 
bit in the Watchdog Mode Register is 1. It is cleared by any of the other 
sources of Reset. 
3 BODR This bit is set when the 3.3 V power reaches a level below 2.6 V. 
If the VDD(DCDC)(3V3) voltage dips from 3.3 V to 2.5 V and backs up, the 
BODR bit will be set to 1. 
If the VDD(DCDC)(3V3) voltage dips from 3.3 V to 2.5 V and continues to 
decline to the level at which POR is asserted (nominally 1 V), the BODR 
bit is cleared. 
if the VDD(DCDC)(3V3) voltage rises continuously from below 1 V to a level 
above 2.6 V, the BODR will be set to 1. 
This bit is not affected by External Reset nor Watchdog Reset. 
Note: Only in case when a reset occurs and the POR = 0, the BODR bit 
indicates if the VDD(DCDC)(3V3) voltage was below 2.6 V or not. 
Cuestiones relacionadas