3.3.1 Embedded SRAM
The STM32F10xxx มีคุณสมบัติมากถึง 96 Kbytes ของ static SRAM. มันสามารถถูกเข้าถึงได้เป็นแบบ bytes, half-words (16 bits) หรือ full words (32 bits). The SRAM start address คือ 0x2000 0000.
3.3.2 Bit banding
The Cortex®-M3 memory map ประกอบด้วย two bit-band regions. regions เหล่านี้ map แต่ละ word ใน an alias region ของ memory ไปยัง a bit ใน a bit-band region ของ memory. การเขียนไปยัง a word ใน the alias region มีผลเดียวกันกับ a read-modify-write operation บน the targeted bit ใน the bit-band region.
ใน the STM32F10xxx ทั้ง peripheral registers และ SRAM ถูก mapped ใน a bit-band region. นี้ยอมให้ single bit-band write และ read operations ถูกปฏิบัติ. The operations นี้มีให้ใช้สำหรับเพียง Cortex®-M3 accesses เท่านั้น, ไม่มีจาก bus masters อื่นๆ (e.g. DMA).
A mapping formula แสดงวิธีการอ้างอิงแต่ละ word ใน the alias region ไปยังบิตที่ตรงกันใน the bit-band region. The mapping formula เป็นดังนี้ :
bit_word_addr = bit_band_base + (byte_offset x 32) + (bit_number × 4)
ที่:
bit_word_addr คือ the address ของ the word ใน the alias memory region ที่ maps ไปยัง the targeted bit.
bit_band_base คือ the starting address ของ the alias region
byte_offset คือจำนวนของ the byte ใน the bit-band region ที่บรรจุ the targeted bit
bit_number คือ the bit position (0-7) ของ the targeted bit.
Example:
ตัวอย่างดังต่อไปนี้แสดงวิธีทำแผนที่ถึงกัน(map) bit 2 ของ the byte ตำแหน่งอยู่ที่ SRAM address 0x20000300 ใน the alias region:
0x22006008 = 0x22000000 + (0x300*32) + (2*4).
การเขียนไปยัง address 0x22006008 มีผลเดียวกันกับ a read-modify-write operation บน bit 2 ของ the byte ที่ SRAM address 0x20000300.
การอ่าน address 0x22006008 คืนค่า (0x01 หรือ 0x00) ของ bit 2 ของ the byte ที่ SRAM address 0x20000300 (0x01: bit set; 0x00: bit reset).
สำหรับข้อมูลที่มากขึ้นบน Bit-Banding อ้างอิงถึง the Cortex®-M3 Technical Reference Manual.