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-10 06:22 PM
Ok, so if you place a break-point in the interrupt code is it hit, or not?
2014-12-11 07:52 AM
Ok, so if you place a break-point in the interrupt code is it hit, or not?
Yes sir, It is working debug run mode but it does not hit the interrupt step by step debugging mode Thank you very much for advice Dear Sir, my next question about GET or INCLUDEdirectives I am expecting to create equates as a separate file ( file name is test.s )and add to main file using GET directive Following are the only things that i included to ''test.s'' file and this test.s file is in the same folderRCC_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
PWR_CR EQU 0X40007000
PWR_CSR EQU 0X40007004
Following is showing the way how I included the test.s to my main program file
Stack_Size EQU 0x00000400
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
PWR_CR EQU 0X40007000
PWR_CSR EQU 0X40007004
DEL1 EQU 0XFFFFF
DEL2 EQU 0Xffffffff
AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
__initial_sp
GET test.s
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; NMI Handler
DCD HardFault_Handler ; Hard Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; SVCall Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD PendSV_Handler ; PendSV Handler
DCD SysTick_Handler ; SysTick Handler
__Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY
ENTRY
; Reset handler routine
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
start BL Sys_init
LOOP BL blink_LED
BNE LOOP
ENDP
stop
Finally following error occurred
startup_stm32f0xx.s(22): error: A1163E: Unknown opcode test.s , expecting opcode or Macro
Please advice
2014-12-11 08:30 AM
Single stepping will not take you into interrupt code.
I'd use test.inc, you don't need to replicate the equates you already have. You should have a space or tab in front of GET so that it's not in the first column.2014-12-11 08:54 AM
Dear Sir,
Thanks for the prompt replyI already used tab in my program for GET directive I used .s and .INC both but result is sameThe equates already have in my main program removed but problem remaining sameI am 100% sure that the program is reading the test.inc file, that should be the reason only one error occurred Errorstartup_stm32f0xx.s(24): error: A1163E: Unknown opcode TEST.INC , expecting opcode or MacroPlease advice2014-12-11 09:33 AM
test.inc
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
PWR_CR EQU 0X40007000
PWR_CSR EQU 0X40007004
END
startup.s
...
INCLUDE test.inc ; GET works too
SysTick_Handler_Test PROC
LDR R1, =GPIOC_ODR
LDR R2, =0x100
LDR R0, [R1]
EORS R0, R2
STR R0, [R1]
BX LR
ENDP
...
2014-12-11 11:14 AM
Yeah, I don't know what you're doing, it works on uv4.74, the only way I get the same error you get is when I have the command in the first column
You need <Space>INCLUDE<Space>test.inc2014-12-11 04:49 PM
2014-12-12 10:10 AM
Dear Sir,
I am now initializing TIM14 following code does not copy to the actual registers at the debugging RCC_APB1ENR EQU 0X4002101C Other registers are showing very correctly but timer 14 related registers should not show the values at the debuggingLDR R6, =RCC_APB1ENR ;TIM14 clock enable bit 8
LDR R0, =0X80
STR R0, [R6]
Please see image for better understand
2014-12-12 12:09 PM
I'm not sure what peripherals are present in your particular chip
LDR R6, =RCC_APB1ENR
LDR R0, =0xFFFFFFFF
STR R0, [R6] ; Set all
LDR R0, [R6] ; See which stick
2014-12-12 05:00 PM
LDR R6, =RCC_APB1ENR ;TIM14 clock enable bit 8
LDR R0, =0X11
STR R0, [R6]
But this code is not working
LDR R6, =RCC_APB1ENR ;TIM14 clock enable bit 8
LDR R0, =0X80
STR R0, [R6]
Only code different is
1.
LDR R0, =0X11
2.LDR R0, =0X80
So, I would need second one which is used to enable clock for TIM14 by setting bit 8 of APB1ENR