ROM_USB_msc for LPC1347 has RAM allocation problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ROM_USB_msc for LPC1347 has RAM allocation problem

542 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CC58 on Mon Jan 21 14:29:49 MST 2013
The ROM_USB_msc ROM code uses RAM space with a pointer without allocating space for its use.
When I try to add variable (2K array) in main.c and write to it, subsequent USB connect causes a hard fault.
If I allocate a 2K array and do no write to it, the thumbdrive comes up normally.
It appears the ROM routines are using RAM space from 0x800 to 0x1000 without informing the C compiler.

Looking at the code in app_usbd_cfg.h
#define MSC_PARAM_MEM    0x10000800
#define MSC_RARAM_SIZE   0x00000800

Which is then reference in main.c for init of USB
  usb_param.mem_base = MSC_PARAM_MEM;
  usb_param.mem_size = MSC_RARAM_SIZE;


I've managed to get around this in an ugly way by editing the MCU settings
such that RAM starts at 0x1000 and ends at 0x2000.  This is not a proper solution.

What is the proper solution?

I believe it entails changing the project's linker directives somehow regarding sections?

Labels (1)
0 Kudos
2 Replies

498 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aakicee on Mon Apr 06 22:31:55 MST 2015
is it the proper solution?
0 Kudos

498 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fcarlo on Tue Feb 05 06:46:49 MST 2013
I think that you should use USB RAM as base memory location from where data and buffers are allocated.
Take a look at the data sheet to know which alignment is required for the data (see "mem_base" for both USBD_API_INIT_PARAM and USBD_MSC_INIT_PARAM)
0 Kudos