Home > other >  STM32F103_ met strange things! For help! I'm going crazy, don't understand. Hex and. The g
STM32F103_ met strange things! For help! I'm going crazy, don't understand. Hex and. The g

Time:10-05

Chip STM32F103ZET6, development environment: keil 5


First:

I defined two specify the location of the variables, a specified in 0 x8024020, another specified in 0 x8024000
Prevent invisible figure, I posted the code set variables:

X8024020 under-16 aim __attribute__ ((at (0)))=2088;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=999;//const volatile


Then I use printf output, statements like this:
Printf (" % x \ r \ n ", * (u32 *) 0 x8024020);
Printf (" % x \ r \ n ", * (u32 *) 0 x8024000);

Program download, then watched a serial port output output goes like this:

Text: 3 e7
828
Conclusion conversion: 0 x3e7=999;
0 x828=2088;
There is no question of output

Next, change the initial value of two download to see if I can rewrite:

To:

X8024020 under-16 aim __attribute__ ((at (0)))=1500;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=777;//const volatile

Same with printf output values

Printf (" % x \ r \ n ", * (u32 *) 0 x8024020);
Printf (" % x \ r \ n ", * (u32 *) 0 x8024000);

The output is:

Text: 309
5 dc
Conclusion conversion: 0 x309=777;
0 x5dc=1500;

The values are successful in this two addresses rewrite

!!!!!!!!!!!!!! See this, it is boring, followed by a strange,

F103ZET6 on chip 512 k FLASH and address 0 x8000000 x8080000 0

Now, I change the address of one, I changed the x8024020 0 to 0 x8074020 address rewrite to far away places, but not beyond the scope of FLASH

Change the initial value at the same time, to observe the change of the value effect

The code was changed to this:

X8074020 under-16 aim __attribute__ ((at (0)))=2888;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=566;//const volatile

Or use printf () output, the code is:

Printf (" % x \ r \ n ", * (u32 *) 0 x8074020);
Printf (" % x \ r \ n ", * (u32 *) 0 x8024000);

Observe the output:


Text: 309
B48

Conversion: 0 x309=777;
0 xb48=2888;

!!!!!!!!!!!!!! Emphasize look at 0 x309 the figures,
In front, I change in one of the addresses at the same time, have to assign to both of them, one of 2888, a 566,
Address 0 x8074020 inside has been adapted into a value of 2888, and the inside of the 0 x8024000 value is still on a 777;


A mystery!!!!!!

Look at the generated. Hex file
Look at the
X8024020 under-16 aim __attribute__ ((at (0)))=2088;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=999;//const volatile
Look at the first. The hex file,
In the generated. Hex file, you can find:
: 10400000 e7030000000000000000000000000000c6
: 1040200028080000410538 a06d01083a0102211a54
In order not to mislead, not to do any changes in these two lines,
Can see: 4000 the address written E703, x3e7 is 0, 999
The address written on the 2808, 4020 x828 is 0, 2088

The next see
X8024020 under-16 aim __attribute__ ((at (0)))=1500;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=777;//const volatile

. Of the hex file,
The same place as you can see:
: 1040000009030000000000000000000000000000 a4
: 10402000 dc050000410538a06d01083a0102211aa3

Can see: the address written on the 0903, 4000 x309 is 0, 777
4020 this address written DC05, namely 0 x5dc, namely 1500

See value was successful rewrite,

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

The
Under-16 aim __attribute__ ((at (0 x 8074020 )))=2888;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=566;//const volatile

Have a look at this "abnormal" hex file:


Text:
: 10754000212808 c0a80178ffffff081b0172011164
: 0 c755000600808dc111111214e00000041

: 02000004 0807 4

: 04402000 480 000049
: 040000050800 a1311d
: 00000001 ff

Last lines. In this hex file, see 0 x08074020 put a, 480 b, the address of the xb48 is 0, that is, 2888
But where 0 x8024000 this address? Where is the data?
See complete. Hex file can be seen in 0 x0801???????? In 7550 was over here, just jump straight to below 0 x0807?????? Section 4020,
Middle is not about 0 x08024000 binary section,


There is a strange thing:

In
X8024020 under-16 aim __attribute__ ((at (0)))=2088; X8024020 under-16 aim __attribute__ ((at (0)))=1500;
And
X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=999; X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=777;

Small offset generated. Hex file, you can see contains a lot of 00,
Line 3371:1072800000000000000000000000000000000000 fe
The
Line 6660:104000003602000000000000000000000000000078

Basic it is 00, occasionally a few other places defined number,

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
However,
Under-16 aim __attribute__ ((at (0 x 8074020 )))=2888;

X8024000 under-16 gTEC3_ParamSave __attribute__ ((at (0)))=566;//const volatile

He generated. There has been no large hex file is very compact, 00 section of

Last lines can be seen:



Line 3415:10754000212808 c0a80178ffffff081b0172011164
Line 3416:0 c755000600808dc111111214e00000041

Line 3417:020000040807 exabytes

Line 3418:04402000480 b000049
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related