Software Timer

sindhukrishnan wrote on Tuesday, October 06, 2015:

Hello !

I use TMS570LS0432 from TI and FreeRTOS code generated from HALCoGen v04.04.00. I tried with example usage for software timers that is mentioned in os_timer.h. I see that after I run debug session, the control enters the first line of the code shown below (os_portasm.asm).

;/-----------------------------------------------------------/
; Start the first task by restoring its context.

    .def vPortStartFirstTask
    .asmfunc

vPortStartFirstTask
cps #0x13
portRESTORE_CONTEXT
.endasmfunc
;/-----------------------------------------------------------/

Later to this the control enters data_abort in dabort.asm

;/-----------------------------------------------------------/
Run Memory Test

.ref	custom_dabort
.def	_dabort
.asmfunc

_dabort
stmfd r13!, {r0 - r12, lr}; push registers and link register on to stack

    ldr		r12, esmsr3			; ESM Group3 status register
    ldr		r0,  [r12]
    tst		r0,  #0x8			; check if bit 3 is set, this indicates uncorrectable ECC error on B0TCM
    bne		ramErrorFound
    tst		r0, #0x20			; check if bit 5 is set, this indicates uncorrectable ECC error on B1TCM
    bne		ramErrorFound2

noRAMerror
tst r0, #0x80 ; check if bit 7 is set, this indicates uncorrectable ECC error on ATCM
bne flashErrorFound

	bl		custom_dabort		; custom data abort handler required
								; If this custom handler is written in assembly, all registers used in the routine
								; and the link register must be saved on to the stack upon entry, and restored before
								; return from the routine.

	ldmfd	r13!, {r0 - r12, lr}; pop registers and link register from stack
	subs	pc, lr, #8			; restore state of CPU when abort occurred, and branch back to instruction that was aborted

;/-----------------------------------------------------------/

What is the reason behind this? Please suggest to solve this issue. Thanks in advance !

rtel wrote on Tuesday, October 06, 2015:

What is the reason behind this?

At this time, I’m afraid I have no idea. I’m not familiar with the project you refer to, the source code looks different from the port in the FreeRTOS download, and you don’t say at which point the abort occurs - but as a first guess I would say perhaps the FreeRTOS interrupt handlers are not installed.

sindhukrishnan wrote on Wednesday, October 07, 2015:

The project is not downloaded from FreeRTOS but I refer to this software timer example found in the end of in FreeRTOS site – http://www.freertos.org/FreeRTOS-timers-xTimerCreate.html

This example was ported to FreeRTOS project created using HALCoGen of TI.

rtel wrote on Wednesday, October 07, 2015:

I tried cutting an pasting the example from the web page you linked to
and found I had to make one edit to enable it to run as expected.

The timer period was being set to ( 100 * x ), but this equals 0 when x
is 0, and 0 is not a valid period for a timer. I therefore changed this
to ( 100 * x ) + 100, and then everything was good.

I have updated the web page accordingly.

Regards.

sindhukrishnan wrote on Friday, October 09, 2015:

Thanks for the support. I would like to know which controller was used to test this code. As mentioned earlier I used the following for this project
TMS570LS0432 from TI and FreeRTOS code generated from HALCoGen v04.04.00. So please explain the environment where this code was used.
Also let me know what is the use and impact of mpu_wrappers in timer?

rtel wrote on Friday, October 09, 2015:

The test was done in the FreeRTOS Windows port, but should run on any of
the 30+ FreeRTOS ports, assuming correct configuration.

Our TMS570 port does not use mpu_wrappers.h.

Regards.

sindhukrishnan wrote on Friday, October 09, 2015:

Referring to this answer, “Our TMS570 port does not use mpu_wrappers.h.”
does it mean Software Timer will work independent of the MPU settings being done in TMS570?

rtel wrote on Friday, October 09, 2015:

It means our port does not use the MPU in the TMS570.