Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

PIC18F USB Memory Hole

Posted by Lukasz Sokol on August 14, 2008
Hello all,

so I've started digging into the documentation of PIC18F2455/2550/4455/4550.

The target I wish to code for is the *4550.

Must admit, that the memory map and access modes are a bit weird to me.

But nevertheless, reading through the FreeRTOS PIC18 port code, I see the need to take the USB memory hole into consideration...

Background :
- The PIC uC's mentioned above, sport a USB module.
- The module is communicating with the core via special dual-port RAM area
Now the tricky bit comes :
- The USB memory area is mapped to memory banks 4 to 7 (400h to 7FFH)
- Considering the GPR area (general-purpose, I suppose that means plain RAM) starts at 060h, the area usable for us is 3 banks*256b (Bank1, Bank2, Bank3) = 768b and area 060h -- 0FFh (160b) area of Bank0. Leaving us with 928 bytes available...

- the manual states, that once the USB module is enabled, the bank 4 (used for USB buffer management) (400h-4FFh) should not be used at all by user code, and the other banks, even if not used for buffers, are not safe.

Conclusion :
- the PIC18FF2455/2550/4455/4550 port needs to be considered being sufficiently different from the normal PIC18 port, to be a separate port.

Question(s):
- to save RAM during context switch, would it be considerable to omit saving/restoration of the 22 bytes of tmpdata and MATHDATA at all? It is bad enough to have the sfr's and 'up to' 3*31 bytes for the hardware return stack addresses.

Ridicule :
- maybe this device(s) just needs an I2C(SPI?) RAM chip attached and the context switching data to be put/pulled there, not into main memory...

RE: PIC18F USB Memory Hole

Posted by Richard on August 15, 2008
Yes...the PIC18 is an unusual beast on does not lend itself too well to larger RTOS apps. If you have to leave a hole in the memory then you may not be able to get a nice big array for the heap, which could lead to having to modify the heap_1.c file too.

With regard to the tmp data and maths data - the C18 compiler does not generate reentrant code and uses this data as a scratch area. Unfortunately you need to store the data as part of the task context. You might get away without storing the math data if you don't do any maths, but most embedded apps will do some calculation or other.

Regards.

RE: PIC18F USB Memory Hole

Posted by Lukasz Sokol on August 15, 2008
Right.
I see now.
It is not a 'hole' as such - it is just a 'low attic'... Will search for the setting of MAX_MEMORY ;) I know it is there just didn't have a chance to find it yet ;)

Hopefully, the C18 compiler wouldn't mess with the USB memory area behind my back :J


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists