2014-11-30 04:00 AM
Dear All ,
I written a program in assembly to tern on bit 8 on GPOIC It is compiled well but LED does not on processor STM32F051R8T6 IDE KEILPRESERVE8
THUMB
RCC_APB2ENR EQU 0X40021018
GPIOC_CRH EQU 0x40011004
GPIOC_ODR EQU 0x4001100C
DEL1 EQU 0X10
DEL2 EQU 0X10
AREA RESET,DATA,READONLY
EXPORT __Vectors
__Vectors DCD 0X20002000
DCD Reset_Handler
ALIGN
AREA MYCODE,CODE,READONLY
ENTRY
EXPORT Reset_Handler
Reset_Handler PROC
clock_init
ldr R6, =RCC_APB2ENR
movs R0, #0x1C
str R0, [R6]
ldr R6, =GPIOC_CRH
ldr R0, =0x3333333
str R0, [R6]
LDR r1, =GPIOC_ODR
LDR r0, =0x0A00
STR r0, [r1]
ENDP
B DELAY
DELAY
SUBS R2,#1
BNE DELAY
DEL SUBS R3,#1
BNE DEL
B Reset_Handler
ALIGN
END
2014-12-04 08:45 AM
Dear Sir,
You are saying INC files aren't available for ARM2014-12-04 09:04 AM
Or you can use the C preprocessor before running the assembler. Your toolchain may have a straighforward support for it (gcc does).
JW2014-12-04 09:34 AM
You are saying INC files aren't available for ARM
These would not appear to be ARM specific equates. I'm saying that if you have your desired equates in some other file, or can generate similar equates by processing a .H file, then do that. There are not a lot of assembler resources available because that's not how the bulk of users are programming their devices. Sometimes you have to fashion your own tools, scripts, or solve problems to your own satisfaction.2014-12-04 08:41 PM
2014-12-04 08:43 PM
Dear Jan,
Grate thanks for the replyI could not understandYour feather explanation in this regard is grate2014-12-05 05:46 AM
Sorry for the confusion - my above proposal would not work here.
Preprocessor would only help if all peripheral-related constants would be directly #defined - this is not the case with the stm32XXxxx.h headers, where addresses are defined indirectly through typedef struct. (Explanation - I worked extensively with AVRs in the near past, using avr-gcc and avr-libc, and the peripheral-defining headers there do use direct defines also for peripheral register addresses). Jan2014-12-05 06:17 AM
INCLUDE FOO.INC ; ??
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/1208.html
http://www.keil.com/support/man/docs/armasm/armasm_dom1361290015482.htm
2014-12-06 06:41 PM
Dear Sir,
I more improved my assemble program adding systic timer After configuring systic timer the LED blinking part stopped after two toggles I do not enable interrupt please adviceTHUMB
RCC_AHBENR EQU 0x40021014
GPIOC_MODER EQU 0x48000800
GPIOC_ODR EQU 0x48000814
STK_CSR EQU 0xE000E010
STK_RVR EQU 0xE000E014
STK_CVR EQU 0xE000E018
STK_CALIB EQU 0xE000E01C
DEL1 EQU 0Xfffff
DEL2 EQU 0Xffffffff
AREA RESET,DATA,READONLY
EXPORT __Vectors
__Vectors DCD 0X20002000
DCD Reset_Handler
ALIGN
AREA MYCODE,CODE,READONLY
ENTRY
EXPORT Reset_Handler
Reset_Handler PROC
start BL Sys_init
LOOP BL blink_LED
BNE LOOP
stop
Sys_init LDR R6, =RCC_AHBENR
LDR R0, =0x80000 ; Bit 19 of RCC_AHBENR
STR R0, [R6]
LDR R6, = GPIOC_MODER
LDR R0, = 0x55555555
STR R0, [R6]
LDR R3,=STK_RVR ;Reload Value Register
LDR R4,=0Xffffff
STR R4,[R3]
LDR R3,=STK_CVR ;Current Value Register
LDR R4,=0X0
STR R4,[R3]
LDR R3,=STK_CSR ;Control and Status Register
LDR R4,=0X7
STR R4,[R3]
BX LR
BX LR
blink_LED LDR R1, =GPIOC_ODR
LDR R0, =0x200
STR R0, [R1]
BL DELAY
LDR R1, =GPIOC_ODR
LDR R0, =0x100
STR R0, [R1]
BL DELAY
B blink_LED
ENDP
DELAY
LDR R1,=DEL1
S SUBS R1,#1
CMP R1,#00
BEQ DELAY1
BNE S
DELAY1 BX LR
ALIGN
END
Or.... I got the point
I enable the ''TICKINT: SysTick exception request enable''
Thanks
2014-12-06 07:41 PM
@jan
Yes, I agreed with you. When we use ''C'' the .H file has everything related to register definitions but in assembly INC files are very rear ( I think ) as explained by clive1 in his post and my previous experience with PIC 8 - 16bit also have INC files, but programmer point of view 32 bit processor working with assembly is long development cycle other than beginners who trying to understand core operations.2014-12-06 08:35 PM
You'd want the vector table to increase in size to contain all of the system handlers, not just the initial SP/PC pair.
Look at a more complete startup_stm32f0xx.s file.