ARM Technical Support Knowledge Articles

How should I write to the System Handler Control and State Register?

Applies to: Cortex-M3

Answer

Care should be taken not to corrupt the state of the System Handler Control and State Register (SHCSR). Although all of the defined bits are writable, the most common reason for writing to this register would be to enable the faults defined in bits[18:16]. Other uses involving writes to the 'state' bits in the lower Halfword include a System handler converting itself from one type to another.

It is good practice to perform read-modify-write accesses to write to the SHCSR. If only one code routine will perform such writes, a simple read-modify-write can be used. If there is more than one routine which may want to write to the SHCSR, some form of mutex should be used to prevent the possibility of interleaved read-modify-write operations resulting from an exception arriving between the read and the write portions of one read-modify-write.

If only the Enable bits[18:16] are being written, a Halfword write to the upper Halfword may be used.

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential