DPSRAM use with freeRTOS

gatolen wrote on Wednesday, July 05, 2017:

Hi , Getting to know freeRTOS better really enjoying using it. I have a training program using a PIC24FJ64GB002 which has a 16 FIFO ADC buffer. I used the FIFO to gather 16 samples then averaging them. Using the info to control servos. I wanted to learn DMA so I moved to the PIC24HJ128GP502 with DMA. The ADC in the 24HJ has just one ADCxBUF so the DMA MOD uses the near memory for its buffer. I adapted the P24FJ files to my working PIC24HJ F file. When I try to build the PIC24HJ I have the new error saying .bss.section no memory for my data. I reduce the heap and I can build my file. I think this is due to the DMA BUFFER. I tried declaring my other two global char arrays which are used for other things, char myarray[] attribute ((far)) , which compiles fine. My question is using the attribute this way allowed and does this then put these arrays in the far mem location. Didn’t see any examples showing this. Can I use some other heap functions (heap 4 maybe) to give me more flexibility to my memory? I have room in my program space visibility for data if I understand it correctly that canbe used. Well anyway freeRTOS seems great and when I get more understanding I’ll make another donation. Thank you guys so much for making freeRTOS for people like me.

rtel wrote on Wednesday, July 05, 2017:

I’m afraid I don’t know what the far attribute does using that compiler,
so would have to look it up myself. You should be able to look in the
map file output by the compiler to see where the allocation ended up though.

heap_5 is the most flexible.

gatolen wrote on Saturday, July 08, 2017:

Thanks for your reply. Let me ask you this question, when I am getting close to running out of data memory is there a way with my chip that freeRTOS could use a section of program memory or could I remap program memory myself?
This is an area I certainly have not any experience in I would just use the partitions that were currently on the chip. It seems very interesting if I could do this. This is probably a question more for the microchip people. I was able to get my program to run now by changing the amount of heap I set in the freeRTOS config file but I know I must be right at that limit. I’ll use the get heap high water mark and see how close I am. I’ll study on how to extend if possible my memory. Thank you for your grt rtos.

richarddamon wrote on Saturday, July 08, 2017:

On the Pic24F series, the Program Memory is Flash, so not really equivalent to data memory. If you have a large amount of read only data, marking it const and telling the compiler to use program memory for it can save data memory (note, you can’t take the address of such an object and get a normal data pointer, so you may need to make some adaptations to your code.