
Ich mache es nur als Hobby.
Code: Alles auswählen
program stm32Blink;
var
APB2ENR: DWord absolute $40021018; // APB2 peripheral clock enable register
PortC: record
CRL, CRH, IDR, ODR, BSRR, BRR, LCKR: uint32;
end
absolute $40011000;
procedure Delay;
var
i: uint32;
begin
for i := 0 to 500000 do
begin
asm
NOP end; // Leerbefehl
end;
end;
begin
APB2ENR := APB2ENR or (1 shl 4); // Clock für GPIOC freigeben.
APB2ENR := APB2ENR or (1 shl 3); // Clock für GPIOB freigeben.
APB2ENR := APB2ENR or (1 shl 2); // Clock für GPIOA freigeben.
// Pin P13 von PortC aud Output.
PortC.CRH := $00300000;
// Hinweis: Die LED leuchtet bei LOW.
repeat
// Pin13 -- High
portc.BSRR := 1 shl 13;
Delay;
// Pin13 -- Low
portC.BRR := 1 shl 13;
Delay;
until 1=2;
end.
Code: Alles auswählen
st-flash write stm32Blink.hex 0x8000000
Code: Alles auswählen
st-flash 1.5.1
2018-10-02T17:56:06 INFO common.c: Loading device parameters....
2018-10-02T17:56:06 INFO common.c: Device connected is: F1 Medium-density device, id 0x20036410
2018-10-02T17:56:06 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
2018-10-02T17:56:06 INFO common.c: Attempting to write 2950 (0xb86) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000800 erased
2018-10-02T17:56:07 INFO common.c: Finished erasing 3 pages of 1024 (0x400) bytes
2018-10-02T17:56:07 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2018-10-02T17:56:07 INFO flash_loader.c: Successfully loaded flash loader in sram
2018-10-02T17:56:10 ERROR flash_loader.c: flash loader run error
2018-10-02T17:56:10 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1
stlink_fwrite_flash() == -1
Code: Alles auswählen
st-flash 1.5.1
2018-10-02T17:58:47 INFO common.c: Loading device parameters....
2018-10-02T17:58:47 INFO common.c: Device connected is: F1 Medium-density device, id 0x20036410
2018-10-02T17:58:47 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 1024 bytes
2018-10-02T17:58:47 INFO common.c: Attempting to write 2950 (0xb86) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000800 erased
2018-10-02T17:58:47 INFO common.c: Finished erasing 3 pages of 1024 (0x400) bytes
2018-10-02T17:58:47 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2018-10-02T17:58:47 INFO flash_loader.c: Successfully loaded flash loader in sram
3/3 pages written
2018-10-02T17:58:47 INFO common.c: Starting verification of write complete
2018-10-02T17:58:47 INFO common.c: Flash written and verified! jolly good!
Code: Alles auswählen
st-flash 1.5.1
2018-10-02T18:01:07 INFO common.c: Loading device parameters....
2018-10-02T18:01:07 WARN common.c: Invalid flash type, please check device declaration
Unknown memory region
Code: Alles auswählen
st-flash write stm32Blink.bin 0x8000000
Code: Alles auswählen
uses
STM32F10x_ld;
Code: Alles auswählen
begin
RCC.APB2ENR := 0;
Code: Alles auswählen
{ platform-dependent types }
{$i sysosh.inc}
Mathias hat geschrieben:Wie kann ich dies umgehen ?
Besser wäre ein System von vom Compiler unabhängigen Definitions-units und über Segmente gesteuerte Linker-scripts.
Welchen STM32 hast du genommen?
Nur etwa 1KB.Wie groß ist deine BIN Datei?
Unter Arduino ist sie gewaltig....
Code: Alles auswählen
Globale Variablen verwenden 3088 Bytes (15%) des dynamischen Speichers, 17392 Bytes für lokale Variablen verbleiben. Das Maximum sind 20480 Bytes.
Code: Alles auswählen
stm32f103xb.pp(3,12) Fatal: Can't find unit stm32f103xb used by stm32Blink
Code: Alles auswählen
Projekt kompilieren, OS: embedded, CPU: arm, Ziel: /home/tux/fpcupdeluxe_stm32/projects/project1.elf: Erfolg
Projekt: Ausführen des Befehls nach: Exit code 255, Fehler: 1
2020-02-23T15:45:22 INFO common.c: Loading device parameters....
2020-02-23T15:45:22 INFO common.c: Device connected is: F1 Medium-density device, id 0x20036410
2020-02-23T15:45:22 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
open(stm32Blink.bin) == -1
2020-02-23T15:45:22 ERROR common.c: map_file() == -1
st-flash 1.6.0
stlink_fwrite_flash() == -1
Panic: tool stopped with exit code 255. Use context menu to get more information.
Code: Alles auswählen
{$O-}
Mathias hat geschrieben:Es gibt den -WpSTM32F103C8 nicht mehr.
Alternativ habe ich mal einen -WpSTM32F103XB probiert.