FreeRtos for the ATXMEGA128A1

Go To Last Post
48 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All,

I need to find out if the freeRTOS has stable working architectures for the ATXMEGA128A1. I already know that Micrium's MicroC RTOS has this support, but for my final decision I would like to evaluated also the freeRtos. The FreeRTOS current version for the AVR32 UC3 doesn't seem to work neither the version for the ATXMEGA256A3.

Thanks,
Yossi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why would you expect an AVR32 version to work on an AVR8? The processors have almost nothing in common apart from the letters A, V and R

But I'm pretty sure that user "stu_san" here has successfully got a port of FreeRtos running on an Xmega so hopefully he'll be along in a moment to tell you more.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the recently revised Newbie? Start here! is the following link:

FreeRTOS for an ATXmega

While I tried to lend a hand, the folks that did the port worked it out for themselves. Kudos to them!

Keep in mind that the ATXmega128A* should work "out of the box". The ATXmega256A* may need to have a revised portSAVE_CONTEXT(), portRESTORE_CONTEXT() and pxPortInitialiseStack() to handle the 3-byte PC (as opposed to 2-byte in the ATXmega128A*). Check out FreeRTOS for ATmega2560/1 for hints on that task.

Best of luck!

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello stu_san

Nice to hear from you. I've read many of your posts, and I highly appreciate your help.

Due the fact that I still can't be synchronized with a stable FreeRtos released for the Atxmega128A1 (and have compilation errors) I would like to display the steps that I've made to build my project:

1. I've found your released called: FreeRTOS version 4.8.0, converted to ATmega128A1

(http://www.avrfreaks.net/index.p....

And download the files.

2. I download the FreeRtos kernel version 4.8.0 (as I believe suggested from this post).

3. Using the AVR studio I prepared a project using the WinAVR-20080430

4. I've added a small main.c file which just make the mandatory initialization of my board and timer0 for the schedule tick, and create only 2 tasks.

5. I tried to compile this project and gut strange overlaps compilation errors (see full rebuild result below).

c:/winavr-20080430/bin/../lib/gcc/avr/4.3.0/../../../../avr/bin/ld.exe: section .task [000031a4 -> 00003383] overlaps section .data [000031a4 -> 00003207]

Questions:
1. What do you mean by 'Keep in mind that the ATXmega128A* should work "out of the box"' do you mean for the your version which I've downloaded and use or the 'fitting freertos to atxmega' which I believe related to the ATxmega256A3.

2. What FreeRtos kernel version should I use?

3. What is the meanning of this compilation error?

Thanks for you support.
Yossi.

Compilation results:
Build started 29.4.2010 at 17:32:16
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT list.o -MF dep/list.o.d -c ../source/list.c

avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT queue.o -MF dep/queue.o.d -c ../source/queue.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT tasks.o -MF dep/tasks.o.d -c ../source/tasks.c

../source/tasks.c: In function 'vTaskIncrementTick':
../source/tasks.c:1343: warning: 'uxSchedulerSuspended' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1353: warning: 'pxDelayedTaskList' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1354: warning: 'pxDelayedTaskList' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1354: warning: 'pxOverflowDelayedTaskList' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1355: warning: 'pxOverflowDelayedTaskList' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1356: warning: 'xNumOfOverflows' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1360: warning: 'pxDelayedTaskList' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1360: warning: 'pxDelayedTaskList' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1360: warning: 'uxTopReadyPriority' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1360: warning: 'uxTopReadyPriority' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1360: warning: 'pxReadyTasksLists' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1364: warning: 'uxMissedTicks' is static but used in inline function 'vTaskIncrementTick' which is not static
../source/tasks.c:1383: warning: 'uxMissedTicks' is static but used in inline function 'vTaskIncrementTick' which is not static
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT croutine.o -MF dep/croutine.o.d -c ../source/croutine.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT integer.o -MF dep/integer.o.d -c ../Demo/Common/Minimal/integer.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT PollQ.o -MF dep/PollQ.o.d -c ../Demo/Common/Minimal/PollQ.c

../Demo/Common/Minimal/PollQ.c: In function 'vStartPolledQueueTasks':
../Demo/Common/Minimal/PollQ.c:127: warning: implicit declaration of function 'vQueueAddToRegistry'
../Demo/Common/Minimal/PollQ.c: At top level:
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT ParTest.o -MF dep/ParTest.o.d -c ../Demo/ParTest/ParTest.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT main.o -MF dep/main.o.d -c ../Demo/main.c

../Demo/main.c: In function '__vector_18':
../Demo/main.c:441: warning: passing argument 3 of 'xQueueGenericSendFromISR' makes integer from pointer without a cast
../Demo/main.c:443: warning: suggest parentheses around assignment used as truth value
../Demo/main.c: At top level:
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT regtest.o -MF dep/regtest.o.d -c ../Demo/regtest.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT CLKSYS_DRIVER.o -MF dep/CLKSYS_DRIVER.o.d -c ../source/avrlib/CLKSYS_DRIVER.c

avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT flash.o -MF dep/flash.o.d -c ../Demo/Common/Minimal/flash.c

../Demo/Common/Minimal/flash.c: In function 'vStartLEDFlashTasks':
../Demo/Common/Minimal/flash.c:96: warning: unused variable 'xLEDTask'
../Demo/Common/Minimal/flash.c: In function 'vLEDFlashTask':
../Demo/Common/Minimal/flash.c:138: warning: unused variable 'uxLED'
../Demo/Common/Minimal/flash.c:137: warning: unused variable 'xLastFlashTime'
../Demo/Common/Minimal/flash.c:137: warning: unused variable 'xFlashRate'
../Demo/Common/Minimal/flash.c: At top level:
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
../Demo/Common/Minimal/flash.c:136: warning: 'vLEDFlashTask' defined but not used
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT TC_driver.o -MF dep/TC_driver.o.d -c ../source/avrlib/TC_driver.c

avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT port_driver.o -MF dep/port_driver.o.d -c ../source/avrlib/port_driver.c

avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT bsp.o -MF dep/bsp.o.d -c ../Demo/bsp.c

../Demo/bsp.c: In function 'BSP_PLL_FreqSet':
../Demo/bsp.c:275: warning: suggest parentheses around arithmetic in operand of |
../Demo/bsp.c: In function 'BSP_Ser_Init':
../Demo/bsp.c:1155: warning: unused variable 'port'
../Demo/bsp.c: In function 'BSP_Ser_RdByte':
../Demo/bsp.c:1273: warning: unused variable 'usart'
../Demo/bsp.c: In function 'BSP_Ser_RdStr':
../Demo/bsp.c:1341: warning: unused variable 'input_ix'
../Demo/bsp.c:1340: warning: unused variable 'rx_data'
../Demo/bsp.c: At top level:
../Demo/bsp.c:1552: warning: 'BSP_LED_Init' defined but not used
../Demo/bsp.c:1591: warning: 'BSP_PB_Init' defined but not used
../Demo/bsp.c:1456: warning: 'BSP_TmrInit' defined but not used
../Demo/bsp.c: In function 'BSP_PB_GetStatus':
../Demo/bsp.c:1113: warning: 'reg_val' is used uninitialized in this function
../Demo/bsp.c: In function 'BSP_Ser_Init':
../Demo/bsp.c:1190: warning: 'usart' is used uninitialized in this function
../Demo/bsp.c: In function 'BSP_Ser_WrByte':
../Demo/bsp.c:1247: warning: 'usart' is used uninitialized in this function
../Demo/bsp.c: In function 'BSP_Ser_RdByte':
../Demo/bsp.c:1299: warning: 'rx_byte' is used uninitialized in this function
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT port.o -MF dep/port.o.d -c ../source/portable/GCC/ATXMega/port.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include\avrlib" -I"C:\xdm\FreeRtos\atxmega_ported_files\source\include" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo" -I"C:\xdm\FreeRtos\atxmega_ported_files\Demo\Common\include" -I"C:\xdm\FreeRtos\atx
mega_ported_files\source\portable\GCC\ATXMega" -mmcu=atxmega128a1 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -fsigned-char -fshort-enums -MD -MP -MT heap_2p5.o -MF dep/heap_2p5.o.d -c ../source/portable/MemMang/heap_2p5.c

C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
C:\xdm\FreeRtos\atxmega_ported_files\source\include/task.h:916: warning: inline function 'vTaskIncrementTick' declared but never defined
avr-gcc -mmcu=atxmega128a1 -Wl,-Map=TestFreeRtosProject.map list.o queue.o tasks.o croutine.o integer.o PollQ.o ParTest.o main.o regtest.o CLKSYS_DRIVER.o flash.o TC_driver.o port_driver.o bsp.o port.o heap_2p5.o -o TestFreeRtosProject.elf
c:/winavr-20080430/bin/../lib/gcc/avr/4.3.0/../../../../avr/bin/ld.exe: section .task [000031a4 -> 00003383] overlaps section .data [000031a4 -> 00003207]
c:/winavr-20080430/bin/../lib/gcc/avr/4.3.0/../../../../avr/bin/ld.exe: section .bss [00003208 -> 00004de1] overlaps section .task [000031a4 -> 00003383]
c:/winavr-20080430/bin/../lib/gcc/avr/4.3.0/../../../../avr/bin/ld.exe: section .isr [00003384 -> 00003389] overlaps section .bss [00003208 -> 00004de1]
tasks.o: In function `vTaskIncrementTick':
C:\xdm\FreeRtos\atxmega_ported_files\default/../source/tasks.c:1372: undefined reference to `vApplicationTickHook'
C:\xdm\FreeRtos\atxmega_ported_files\default/../source/tasks.c:1385: undefined reference to `vApplicationTickHook'
PollQ.o: In function `vStartPolledQueueTasks':
C:\xdm\FreeRtos\atxmega_ported_files\default/../Demo/Common/Minimal/PollQ.c:127: undefined reference to `vQueueAddToRegistry'
main.o: In function `vHandlerTask':
C:\xdm\FreeRtos\atxmega_ported_files\default/../Demo/main.c:427: undefined reference to `vTaskPrioritySet'
port.o: In function `vPortYieldFromTick':
C:\xdm\FreeRtos\atxmega_ported_files\default/../source/portable/GCC/ATXMega/port.c:636: undefined reference to `vTaskIncrementTick'
make: *** [TestFreeRtosProject.elf] Error 1
Build failed with 8 errors and 73 warnings...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The OP sent me a private message with essentially the same text as above. For others who may come down this path, I am posting my response here. I've corrected a couple of typos and made one reference clearer than my note to Yossi...stu

-----------------------------------------------------------------------------

I think I may be able to pinpoint your problem.

yossi13 wrote:
3. Using the AVR studio I prepared a project using the WinAVR-20080430
This is too old. You must use the latest version of WinAVR (20100110). At the very earliest, 20090313 may work. Version 20080430 did not have sane ATXmega support.

yossi13 wrote:
5. I tried to compile this project and gut strange overlaps compilation errors (see full rebuild result below).
There should have been a custom linker script (linker_script.x) file which you must use instead of the standard linker script. If you don't want to do this (which I understand), go to portmacro.h and change
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__ ((section (".task")))

to

#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )

[The original] code forces all Task routines to be in a special linker section. It was done for the ATmega2560 (and makes sense for the ATXmega256A*) to ensure that all task routines end up in the bottom half of flash. Read the section on the Task Stack initialization as to why this is necessary.

yossi13 wrote:
1. What do you mean by 'Keep in mind that the ATXmega128A* should work "out of the box"' do you mean for the your version which I've downloaded and use or the 'fitting freertos to atxmega' which I believe related to the ATxmega256A3.
There are two different modified versions of FreeRTOS - one for the non-Xmega ATmega2560 and the other for the Xmega.
Here's FreeRTOS for ATmega2560/1
Here's FreeRTOS for an ATXmega

yossi13 wrote:
2. What FreeRtos kernel version should I use?
If you are using the ATmega2560, use the first reference.

If you are using an Xmega128, use the second reference.

If you are using an Xmega256, you will need to use a combination of both. I would start with the Xmega128 version, then read the ATmega2560 reference for changes that will be needed to support the 3-byte Program Counter in the ATXmega256.

I hope this helps!!

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Stu,

Thanks for your quick reply.

The 'FreeRTOS for an ATXmega version' link which you recommend me for the ATXmega128 contains only 4 files. What is the base of this version? Can I use the latest available FreeRtos kernel version (6.04) or do I need an earlier version?

Yossi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe the header at the top of the FreeRTOS files will tell you that. Ahh, yes:

FreeRTOS.org V5.3.1 - Copyright (C) 2003-2009 Richard Barry.

Read the Source, my young Padawan! :twisted:

As I recall (having just upgraded to FreeRTOS 6.0.something myself) there is not much impact of the ported files on the main FreeRTOS code, which is as it should be. Code specific to the processor should not be severely affected by main code revisions. If you cannot get 5.3.1, get the latest and use the Xmega files in the appropriate directories.

You might also want to get the attention of hy6r0t3d as he was the one who put this together.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Stu,

It looks good. The OS (5.3.1) works fine in my board. 3 tasks with a single semaphore are working as designed.

Now it's time for the some evaluation process and later on starting the real work…

Thanks a lot for your help, and sorry for my beginner's questions in the FreeRtos platform (You're probably used to it :))

Cheers,
Yossi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Linking: rtosdemo.elf
avr-gcc -mmcu=atmega32 -I. -D GCC_MEGA_AVR -I. -I../../Source/include -I../Common/include -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wunused -Wa,-adhlns=main.o -std=gnu99 main.o ParTest/ParTest.o serial/serial.o ../../Source/tasks.o ../../Source/queue.o ../../Source/list.o ../../Source/portable/MemMang/heap_1.o ../../Source/portable/GCC/ATMega323/port.o ../Common/Minimal/flash.o ../Common/Minimal/integer.o ../Common/Minimal/PollQ.o ../Common/Minimal/comtest.o --output rtosdemo.elf -Wl,-Map=rtosdemo.map,--cref -lm
../../Source/portable/GCC/ATMega323/port.o: In function `vPortYieldFromTick':
/home/student/Download/FreeRTOS/Demo/AVR_ATMega323_WinAVR/../../Source/portable/GCC/ATMega323/port.c:358: undefined reference to `vTaskIncrementTick'
/home/student/Download/FreeRTOS/Demo/AVR_ATMega323_WinAVR/../../Source/portable/GCC/ATMega323/port.c:359: undefined reference to `vTaskSwitchContext'
../../Source/portable/GCC/ATMega323/port.o: In function `vPortYield':
/home/student/Download/FreeRTOS/Demo/AVR_ATMega323_WinAVR/../../Source/portable/GCC/ATMega323/port.c:341: undefined reference to `vTaskSwitchContext'
make: *** [rtosdemo.elf] Error 1

Dear Friends,

I am new to FreeRTOS. I am using ATmega32-16PU controller. When I am doing ' make clean ' it shows no error. but after doing 'make all' it shows above mention error.

I am using LINUX os.

Please help me

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Although this thread is about FreeRTOS, your question really has nothing to do with this one since you are using an ATmega32 and this thread is about using an Xmega128 (really different beasts, trust me). This is called "hijacking a thread".

Before posting again, please read Help, My "..." Doesn't Work!

I'm going to hate myself for asking this, but, after reading the pointer I gave, please repost your problem in a new thread. When you do, please include the following information:

- How did you get avr-gcc on your Linux system (teacher gave it to you, you used the Bingo600 script talked about in the sticky thread at the top of this forum, got it straight from Ubuntu, ...)

- Which version of FreeRTOS are you using?

- Full listing of a good make and a bad make.

- The Makefile you use to build the demo. (Offhand, it appears that the object list is incomplete.)

I'll be waiting for your post.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Stu-San, Hi All!!!

I also tried your version of FreeRTOS for AT Xmega128A1.
I tried to port the code in an Xmega32D4 which is almost the same controller than the 128A1... (I only have less RAM, no dma and so...).

I'm using the code you published a few time ago (posted above in april 2010)... And I've the same compiling warnings than the other user:
../task.h:979: warning: inline function 'vTaskSwitchContext' declared but never defined
../task.h:979: warning: inline function 'vTaskIncrementTick' declared but never defined

What could be these messages? I tried to remove inline attributes in header file and then, my program compiles without warnings but when I try to run my application, vTaskDelay function may not correctly work...
Does this problem with vTaskDelay function come from the fact I removed inline attribute in task.h file?

Waiting for your help; than you by advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

vTaskSwitchContext() is defined in tasks.c - you are building in those core files aren't you?

 Directory of D:\FreeRTOS\Source

16/05/2009  21:11              .
16/05/2009  21:11              ..
20/11/2008  16:12            14,127 croutine.c
20/11/2008  12:05              include
20/11/2008  16:12             6,709 list.c
20/11/2008  12:05              portable
20/11/2008  16:12            49,778 queue.c
20/11/2008  11:52               666 readme.txt
20/11/2008  16:12            63,552 tasks.c

Here's the file list of a "minimal" project (actually this was for mega168):

 Directory of D:\FreeRTOS\test168

18/05/2009  16:24              .
18/05/2009  16:24              ..
05/08/2009  11:05              default
20/11/2008  16:12            12,002 FreeRTOS.h
18/05/2009  12:53             4,039 FreeRTOSConfig.h
20/11/2008  16:12             5,317 heap_1.c
20/11/2008  16:12             6,709 list.c
20/11/2008  16:12            12,271 list.h
18/05/2009  16:24             6,121 main.c
16/05/2009  20:46            10,798 makefile
17/05/2009  15:22            15,035 port.c
17/05/2009  14:48             8,373 portable.h
17/05/2009  14:48             4,770 portmacro.h
20/11/2008  16:12             2,938 projdefs.h
17/05/2009  19:19            49,780 queue.c
20/11/2008  16:12            45,562 queue.h
19/05/2009  11:14            47,540 sourceLineMap.txt
20/11/2008  16:12             8,487 StackMacros.h
20/11/2008  16:12            36,031 task.h
20/11/2008  16:12            63,552 tasks.c
18/05/2009  17:11             5,075 TestRTOS.aps
05/08/2009  11:09               594 TestRTOS.aws

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

These two functions are effectively defined in task.c.
I saw their in the source code.
It seems that they are not in a specific #ifdef so I don't understand how it's possible that they appear as "not defined".

The only difference I have with your listing is that I don't have croutine.c...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I saw their in the source code.
It seems that they are not in a specific #ifdef so I don't understand how it's possible that they appear as "not defined".

Look at the pre-processed source - pass "-E" rather than "-c" to the compiler and the files output will be those after the preprocessing has been performed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Clawson,

Thank you for your help !!
I checked my compiler options in avr studio 4 and I don't have -c option... Moreover, when i put -E option, my compiling is quiet long and avr studio 4 seems to be blocked in a infinite loop...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah if you are using Studio then to get the preprocessed files go to Project-Config_opts and
under "Custom Options" make sure that "[All files]" is highlighted then in the box to the left
or [Add] enter "-save-temps" then click the [Add] button. Now when you build in the ./default
output directory for each file.c you will find an additional file.i and file.s - the .i file
is the pre-processed source and the .s is the generated Asm that is passed to the assembler.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cliff, unless you are seeing something I'm not, I think the crux of the problem is that task.h has vTaskSwitchContext() and vTaskIncrementTick() declared "inline", but there's no code to go with that in the .h.

The odd part is that those functions are actually defined in the file port.c - they're part of the processor dependent code.

I'm going to take a quick look in my code to see how these are declared and defined, and I'll be back...

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess my FreeRTOS (admittedly quite old) has missed the boat. My one makes no mention of "inline" on those functions:

D:\FreeRTOS\test168>grep  vTaskSwitchContext *
port.c: vTaskSwitchContext();
port.c: * vPortYield() from the call to vTaskSwitchContext() onwards.  The only
port.c: vTaskSwitchContext();
task.h:void vTaskSwitchContext( void );
tasks.c:void vTaskSwitchContext( void )

In which you can see it declared in task.h, defined in tasks.c and invoked in port.c

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just downloaded the latest v6 (mine was a v5 variant) and the one obvious change is in the .h file:

D:\FreeRTOS\Source\include>grep vTaskSwitchContext *
task.h:void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;

which has spouted and additional "PRIVILEGED_FUNCTION". When I grep for that I get:

D:\FreeRTOS\Source\include>grep PRIVILEGED_FUNCTION *.h
mpu_wrappers.h:         #define PRIVILEGED_FUNCTION
mpu_wrappers.h:         #define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))

So no, I don't know WHERE you chaps are seeing "inline" on this function ?!?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi both,

Effectively, those functions are declared as inline in .h file.
And the associated code is in .c file.

These functions are then called in port.c file...

When i generated the .s and .i file, vTaskSwitchContext and vTaskIncrementTick appear as inline function in .h file...

Do you think that my problem of no-working vTaskDelay function is linked to this fact if I removed inline attribute ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

a short extract of .i file
# 956 "../task.h"
signed char xTaskRemoveFromEventList( const xList * const pxEventList );
# 969 "../task.h"
void vTaskCleanUpResources( void );
# 979 "../task.h"
inline void vTaskSwitchContext( void );

Be careful; the source code I'm using is this one -->
http://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay, I was totally wrong. Those routines are defined in task.c - I got them confused with the taskYIELD() function.

I suspect that some of @julienb's problems are that AVR Studio is not fond of compiled files in anything other than a single directory. If he has done what I suspect, he has his FreeRTOS files in some other directory than his test directory.

@julienb: It is better, when using FreeRTOS, that you use an external makefile. You can create one using the Mfile utility that comes with WinAVR. Then, in AVR Studio, under Project Configuration, point at the makefile you created.

Second comment: FreeRTOS is probably overkill for any project on a 32 KByte flash device. While it should work, I would ask what resources FreeRTOS provides that you will need in your project. Most likely you can do it more efficiently another way.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Be careful; the source code I'm using is this one -->
http://www.avrfreaks.net/index.p... ... em_id=2342

Now you have me really confused. There is no include/task.h or task.c in the .zip associated with that Academy project. It contains only the port* files that are specific to the Xmega. You must have sourced the task.c from elsewhere and as your .i file shows the function in your case in "inline", yet the files I have both from FreeRTOS 5.1.1 and the very latest 6.0.5 do not have "inline" on the function. So I'd look at the provenance of the file set you are trying to use.

If I was you I'd download today's 6.0.5 then apply those academy port* from the .zip to that and then try to make it build. As my directory listings above show I got it to work with .aps files in Studio but they also show that I did that by copying the core files and the port files and my own application files all into a single directory so the .aps could easily "see" them.

Cliff

EDIT in fact attached is a file I've posted here before which is a very simple mega168 project that builds and runs in Studio. You might want to use this as a "starting point" or certainly as a template set of files that builds coherently that you can compare a none building/working tree against.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I checked my Studio project. Unfortunately, i have all my files in the same directory...

So, i'll try a own makefile and will have a look at the clawson's project even if it is compiled for ATmega controller and not Xmega like me...

Thank you for your answers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@julienb: Here is your project with my modifications.

You should have also included the Makefile - since you did not, I created my own. I have also included my AVR Studio project files, although they are probably useless to you.

The best way to set F_CPU is in the Makefile. You will see where I set it.

Make sure that the value for F_CPU and configCPU_CLOCK_HZ are the same. In fact, it makes sense in FreRTOSConfig.h to do:

#define configCPU_CLOCK_HZ  F_CPU

Another point: Although 1 mS task ticks might make sense with a faster clock, with a 1 MHz clock you will find that your tasks get little work done. It is okay for your little tests but I would definitely think of a much faster clock if you are going to keep the 1 mS tick rate.

I'm not sure why the avr_compiler.h file was there - most of the defines were old. Use the up-to-date avr-libc defines instead.

I set up the three tasks with separate bit-flipping so you can get an idea of which task is firing.

I renamed your file FreeRtosXmega128.c to Test.c - it made the AVR Studio project easier to handle. (I didn't want a directory named FreeRtosXmega128!) Of course, you are free to rename it back.

Since you are hung in vTaskDelay, make sure that TCC0_OVF_vect is being called (in other words that the timer is set up and interrupting). This is the most likely source of your problem.

That's the best I can do. Hope it helps!

Stu

Attachment(s): 

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all and thank you for the nice workout here.
Has anyone worked on the freeRTOS port and created any sample project using Atmel Studio 6? if got one, then it will be very nice to start new project with. I'm using atxmega128A4u. Thank you

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, I am currently using Freertos WITH XmEGA128a1 AStudio 6. It works very well, but there are some buts...
1) I haven't looked into the changes needed to work ouside the 64k FLASH , so if you don't have code there (at least tasks) it should be ok. As far as I know freertos and the compiler will leave the RAMP registers to 0.
2) Some functions I use from ASF haven't been completely adopted to "automation" meaning that despite the clock is defined to be 32MHz in the freertos configuration, the tick timer is hardcoded by me, it does not take into account the 32MHz definition yet.

I am still working on this, so I will discover mistakes, and make changes soon.the initial port is NOT mine, just a few adaptation to my needs... If interested, let me know!

Cheers

There are 10 kinds of people... those who digg binary and those who don't

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sagi2313 wrote:
Hello, I am currently using Freertos WITH XmEGA128a1 AStudio 6. It works very well, but there are some buts...
1) I haven't looked into the changes needed to work ouside the 64k FLASH , so if you don't have code there (at least tasks) it should be ok. As far as I know freertos and the compiler will leave the RAMP registers to 0.
2) Some functions I use from ASF haven't been completely adopted to "automation" meaning that despite the clock is defined to be 32MHz in the freertos configuration, the tick timer is hardcoded by me, it does not take into account the 32MHz definition yet.

I am still working on this, so I will discover mistakes, and make changes soon.the initial port is NOT mine, just a few adaptation to my needs... If interested, let me know!

Cheers

Hi sagi2313
Thank you for your reply.
Can you share your project, even am finding the same mistake in my AS6 project, its hanging forever in vtaskdelay. One more thing, there are tc_driver.h and tc_driver.c files missing from the original port (as of now), so I've adopted another port obtained somewhere, it might also be the reason. It would be great help if you share your AS6 project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
FYI my project does not use the ASF FreeRtos version. I have included the source for FreeRtos manually , from a port I found on the web, and tweaked it a little. Latter today , when I get back home, I will send you the files you need to start a clean project.

Cheers

There are 10 kinds of people... those who digg binary and those who don't

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi
again thank you for reply. My project at all is not needed to be something from ASF. Please do send me the Atmel studio 6 project that you've built so that I can start a project on atxmega128a4u from that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The clean AS6 project, sorry for the delay!
this has not been completed to work for code @ >64K flash.
The port is NOT mine, I just setup a few parameters, but didn't change core code / functionality. It is just a project under construction.
Hope It helps

Attachment(s): 

There are 10 kinds of people... those who digg binary and those who don't

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello
I'm grateful to you for posting me the project, you needles be sorry if someone is ready to help, it will be off course following his own time, rather its very nice of you to post it. I'll try this and let you know. Currently am using atxmega128a4u, so lets see if after few tweeks this work or not!!! Thank you for taking time to send this

Amit

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi sagi2313 as a dirty check, after downloading the project and opening in atmel studio 6 and just pressing build(rebuild also). Additionally i was not able to view the project properties to do any changes. If this is modeled before, please let me know why this happened. Below is error message

------ Build started: Project: FreeRtosXmega_Clean, Configuration: Debug AVR ------
								Build started.
								Project "FreeRtosXmega_Clean.cproj" (default targets):
								Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
								Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.0\Vs\Compiler.targets" from project "C:\Users\Amit\Downloads\Compressed\FreeRtosXmega_Clean\FreeRtosXmega_Clean\FreeRtosXmega_Clean\FreeRtosXmega_Clean.cproj" (target "Build" depends on it):
									Task "RunCompilerTask"
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no error there.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To be honest, I don't know what is going on. I can only suggest ideas:
1)Try to open the solution
if it fails
2)Try to open the project
if it fails
3) create a new solution for userboard xmegaA1 and import the project
if it fails
4) create a solution + project from scratch and manually include files

That is what I do , when stuck

Good Luck

There are 10 kinds of people... those who digg binary and those who don't

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But there is no error there. It simply says:

                        Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!=''). 

That isn't an error. AS6 always says that when it goes to execute pre build steps and find there is nothing to be done.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi clawson
thank you for reply.
If its not error, then how one is supposed to do any changes and build the project?? every time i buid it, its giving the same errors regardless of changes in c file, or source addition or removal. thank you

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The above would seem to suggest that the build system thinks there is nothing to be rebuilt. Try locating any .d files in the build directory and delete them. They are temporary files with dependency info and are what the build system uses to determine if anything needs to be built.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, thanks for your suggestion, but there was no other .d file in that directory.
Meanwhile using the port suggested by stu_san and using the freeRTOS 5.3.1, i've build a new port using AS6, i've added all the required files and removed possible errors, the last thing it now says is memory overflow.

Error	1			Program Memory Usage 	:	9216 bytes   6.6 % Full
				Data Memory Usage 		:	12223 bytes   149.2 % Full	(Memory Overflow)	freakProject	0	0	freakProject

What could have caused this?? I've attached the project that I am using, its built around atxmega128a4u. Thank you

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I built that and looked at the .map file. The main user of RAm is:

 .bss           0x00802006     0x2ee2 MemMang/heap_1.o

0x2EE2 is 12,002 bytes. That's a LOT of RAM!

It comes from:

static union xRTOS_HEAP
{
	volatile unsigned portLONG ulDummy;
	unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ];
} xHeap;

in heap_1.c. The constant value there is:

#define configTOTAL_HEAP_SIZE		( (size_t ) ( 12000 ) )

which is in freeRTOSconfig.h

I suggest that may be rather over-egging the pudding!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ohk,
thank you for such quick response, i've got the error. But please note that I'm using freertos for the first time, so shall i use the entire RAM size in the freertosconfig.h file or something less than that?

#define configTOTAL_HEAP_SIZE      ( (size_t ) ( 8000 ) )

will it be ok, am so asking because I'm further to use SD card drivers and 3 UARTs in it. Am not getting how to allocate it

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ohk,
thank you for such quick response, i've got the error. But please note that I'm using freertos for the first time, so shall i use the entire RAM size in the freertosconfig.h file or something less than that?

#define configTOTAL_HEAP_SIZE      ( (size_t ) ( 8000 ) )

will it be ok, am so asking because I'm further to use SD card drivers and 3 UARTs in it. Am not getting how to allocate it

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well it comes down to how much heap you tihnk the tasks you are going to write will use. The answer may be (quite possibly will be) 0 in fact. In which case either don't allocate anything for this or just a handful of bytes.

Even when using an RTOS in a RAM constrained system like an AVR you may be better off pre-allocating buffers in .bss than using a heap at run time as you will have a better up from picture of RAM usage.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the nice inputs. I'll surely try various values and select which to use. Meanwhile i'm getting a strange error now, the project builds well but in debug, the program is stopped and some disassembly is shown from where it never returns. I'm not getting at all whats happening. The AS6 project is attached

Thank you

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
the program is stopped and some disassembly is shown from where it never returns. I'm not getting at all whats happening.

The heap is just a (usually .noinit) portion of SRAM which is consumed by tasks and queues. That happens at run-time in FreeRTOS and that is why you can instantiate or kill a task any time (not sure about fork). The tasks use that assigned heap part mainly for stack so if you instantiate some task with stack_size == 0x100 then this quantity is assigned from heap to that specific task. Now, if that 0x100 was a lie and this task calls a:

void foo(void){
auto uint8_t lets_overrun_neighbors_stack[0xF0];
...
}

with some IRQs in the meantime then that is where problems star$%^&8#@&*9)&^%....&*

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brutte wrote:
... then that is where problems star$%^&8#@&*9)&^%....&*
You are not allowed to be funny in a serious thread. Mostly because hot coffee out the nose really hurts.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Amitrana, there are some tips I can give you.
Freertos will need some RAM for its internal variables. Tha means, you can't give all RAM to the heap. Even if you could, you would run out of stack for the rest of the code. The FreeRtos Heap that you declare as "configTOTAL_HEAP_SIZE X" could be thought of as an array of size X bytes(or size_t).
SO in any programm, if you declare such an array, you will have used up all of your RAM. Apart from these to factors, even if you had NO tasks , when the FreeRtos Sheduler is started, it will create the
Idle Task. This alone will need some stack space. Since the stack for ANY task created, is used to store 32 bytes of registers, plus SREG plus SP
and a few other parameters for the task functionality, it is a good practice to have a minimum task stack of 64 bytes. So you must calculate at least 64 bytes for Idle Task, 64 (or more) for each other Task (or task instance) that you have, and some memory for the kernel internal vars, that varies depending on the features that you include/enable from the FreeRtos Config.After all that you must allow for some space for the non-kernel stack (function calls, local vars etc). If you are using functions like printf, that should be even more.

As a practical calculation, for a demo project to get started, I suggest you give 256 or 512 bytes to configTOTAL_HEAP_SIZE, if your chip has 1024 bytes ram(just an example). Also make sure to make your configMINIMAL_STACK_SIZE at least 64 bytes, I suggest more.
Here is a part of my config( nearly the same I included in the uploaded project):

#define configUSE_PREEMPTION                    1

#define configUSE_TICKLESS_IDLE                 0
#define configCPU_CLOCK_HZ			( ( unsigned long ) 32000000 )
#define configTICK_RATE_HZ			( ( portTickType ) 1000 )
#define configMAX_PRIORITIES		        ( ( unsigned portBASE_TYPE ) 4 )
#define configMINIMAL_STACK_SIZE		( ( unsigned portBASE_TYPE ) 128 )
#define configTOTAL_HEAP_SIZE			( (size_t ) ( 512 ) )
#define configMAX_TASK_NAME_LEN			( 8 )
#define configUSE_16_BIT_TICKS                  1
#define configIDLE_SHOULD_YIELD                 0
#define configUSE_MUTEXES                       0
#define configUSE_RECURSIVE_MUTEXES             0
#define configUSE_COUNTING_SEMAPHORES           0
#define configQUEUE_REGISTRY_SIZE               0
#define configUSE_QUEUE_SETS                    0
#define configUSE_TIME_SLICING                  1
#define configUSE_NEWLIB_REENTRANT              0

/* Hook function related definitions. */
#define configUSE_IDLE_HOOK                     0
#define configUSE_TICK_HOOK                     1
#define configCHECK_FOR_STACK_OVERFLOW          1
#define configUSE_MALLOC_FAILED_HOOK            1

You can use the super usefull Hooks- seen on the last 2 lines. to find out when and why
a memory error occurs.
By setting them to 1, you need to add callback functions in your code and handle/detect, memory errors.

void vApplicationStackOverflowHook( xTaskHandle xTask, signed char *pcTaskName )
{
	unused(xTask);
	unused(pcTaskName);
while(1);
}
void vApplicationMallocFailedHook(void)
{
	while(1);
}

FreeRtos has also more advanced memory / stack tracing methods, but you should refer to documentation.

Hope It helps

There are 10 kinds of people... those who digg binary and those who don't

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That surely will help a lot of value addition to my freertos knowledge. thanks alot.

am trying to figure out currently why the code is not working as in my last post, its hanging in the startup code itself (in debug). If you can please test it, please let me know. anyways once I'm done with it, I'll repost it here for any further usage for others.
Thanks