У вас в начале топика в корне не правильная формула расчета
д.б. примерно так:
Код
// в начале файла, если этипеременные глобальные:
u32 a;
u32 *b;
// в теле какой-либо функции, перед использованием b:
b = (u32 *)( 0x22000000 + ((u32)(&a)- 0x20000000)*32);
Дело в том что на этапе компиляции, еще не известны все адреса и компилятор не может вычислить такое сложное выражение
Но в теле какой-либо функции можно схитрить, вычислив адрес как простое арифметическое выражение и преобразовать его в адрес.
Если же вы хотите задать значение "b" на этапе компиляции, то возможно вам надо расположить "a" по строго определенному адресу. Для этого изучайте директивы линковщика и компилятора.
Цитата
A mapping formula shows how to reference each word in the alias region to a corresponding
bit in the bit-band region. The mapping formula is:
bit_word_addr = bit_band_base + (byte_offset x 32) + (bit_number × 4)
where:
bit_word_addr is the address of the word in the alias memory region that maps to the
targeted bit.
bit_band_base is the starting address of the alias region
byte_offset is the number of the byte in the bit-band region that contains the targeted bit
bit_number is the bit position (0-7) of the targeted bit.
Example:
The following example shows how to map bit 2 of the byte located at SRAM address
0x20000300 in the alias region:
0x22006008 = 0x22000000 + (0x300*32) + (2*4).
Writing to address 0x22006008 has the same effect as a read-modify-write operation on bit
2 of the byte at SRAM address 0x20000300.
Reading address 0x22006008 returns the value (0x01 or 0x00) of bit 2 of the byte at SRAM
address 0x20000300 (0x01: bit set; 0x00: bit reset).
Сообщение отредактировал alexeyv - Sep 3 2011, 09:35