mirror of https://github.com/ARMmbed/mbed-os.git
commit
96ea3db1b3
|
@ -439,13 +439,20 @@ extern "C" int __end__;
|
||||||
#undef errno
|
#undef errno
|
||||||
extern "C" int errno;
|
extern "C" int errno;
|
||||||
|
|
||||||
|
// For ARM7 only
|
||||||
|
register unsigned char * stack_ptr __asm ("sp");
|
||||||
|
|
||||||
// Dynamic memory allocation related syscall.
|
// Dynamic memory allocation related syscall.
|
||||||
extern "C" caddr_t _sbrk(int incr) {
|
extern "C" caddr_t _sbrk(int incr) {
|
||||||
static unsigned char* heap = (unsigned char*)&__end__;
|
static unsigned char* heap = (unsigned char*)&__end__;
|
||||||
unsigned char* prev_heap = heap;
|
unsigned char* prev_heap = heap;
|
||||||
unsigned char* new_heap = heap + incr;
|
unsigned char* new_heap = heap + incr;
|
||||||
|
|
||||||
|
#ifdef __get_MSP
|
||||||
if (new_heap >= (unsigned char*)__get_MSP()) {
|
if (new_heap >= (unsigned char*)__get_MSP()) {
|
||||||
|
#else
|
||||||
|
if (new_heap >= stack_ptr) {
|
||||||
|
#endif
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (caddr_t)-1;
|
return (caddr_t)-1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,7 @@ SECTIONS
|
||||||
. = ALIGN( 8 ) ;
|
. = ALIGN( 8 ) ;
|
||||||
__heap_start__ = . ;
|
__heap_start__ = . ;
|
||||||
end = . ;
|
end = . ;
|
||||||
|
__end__ = . ;
|
||||||
|
|
||||||
.stab 0 (NOLOAD) : { *(.stab) }
|
.stab 0 (NOLOAD) : { *(.stab) }
|
||||||
.stabstr 0 (NOLOAD) : { *(.stabstr) }
|
.stabstr 0 (NOLOAD) : { *(.stabstr) }
|
||||||
|
|
|
@ -42,7 +42,7 @@ static const PinMap PinMap_ADC[] = {
|
||||||
|
|
||||||
void analogin_init(analogin_t *obj, PinName pin) {
|
void analogin_init(analogin_t *obj, PinName pin) {
|
||||||
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC);
|
||||||
if (obj->adc == (uint32_t)NC) {
|
if (obj->adc == (ADCName)NC) {
|
||||||
error("ADC pin mapping failed");
|
error("ADC pin mapping failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ static const PinMap PinMap_DAC[] = {
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
void analogout_init(dac_t *obj, PinName pin) {
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
if (obj->dac == (uint32_t)NC) {
|
if (obj->dac == (DACName)NC) {
|
||||||
error("DAC pin mapping failed");
|
error("DAC pin mapping failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -697,7 +697,7 @@ int ethernet_receive() {
|
||||||
if(receive_idx == -1) {
|
if(receive_idx == -1) {
|
||||||
receive_idx = LPC_EMAC->RxConsumeIndex;
|
receive_idx = LPC_EMAC->RxConsumeIndex;
|
||||||
} else {
|
} else {
|
||||||
while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && (receive_idx != LPC_EMAC->RxProduceIndex)) {
|
while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) {
|
||||||
receive_idx = rinc(receive_idx, NUM_RX_FRAG);
|
receive_idx = rinc(receive_idx, NUM_RX_FRAG);
|
||||||
}
|
}
|
||||||
unsigned int info = rxstat[receive_idx].Info;
|
unsigned int info = rxstat[receive_idx].Info;
|
||||||
|
@ -713,7 +713,7 @@ int ethernet_receive() {
|
||||||
LPC_EMAC->RxConsumeIndex = receive_idx;
|
LPC_EMAC->RxConsumeIndex = receive_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(receive_idx == LPC_EMAC->RxProduceIndex) {
|
if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) {
|
||||||
receive_idx = -1;
|
receive_idx = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +762,7 @@ int ethernet_read(char *data, int dlen) {
|
||||||
void *pdst, *psrc;
|
void *pdst, *psrc;
|
||||||
int doff = 0;
|
int doff = 0;
|
||||||
|
|
||||||
if(receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
|
if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
void pin_function(PinName pin, int function) {
|
void pin_function(PinName pin, int function) {
|
||||||
if (pin == (uint32_t)NC) return;
|
if (pin == (PinName)NC) return;
|
||||||
|
|
||||||
uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
|
uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
|
||||||
int index = pin_number >> 4;
|
int index = pin_number >> 4;
|
||||||
|
@ -28,7 +28,7 @@ void pin_function(PinName pin, int function) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void pin_mode(PinName pin, PinMode mode) {
|
void pin_mode(PinName pin, PinMode mode) {
|
||||||
if (pin == (uint32_t)NC) { return; }
|
if (pin == (PinName)NC) { return; }
|
||||||
|
|
||||||
uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
|
uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0;
|
||||||
int index = pin_number >> 5;
|
int index = pin_number >> 5;
|
||||||
|
|
|
@ -57,7 +57,7 @@ static unsigned int pwm_clock_mhz;
|
||||||
void pwmout_init(pwmout_t* obj, PinName pin) {
|
void pwmout_init(pwmout_t* obj, PinName pin) {
|
||||||
// determine the channel
|
// determine the channel
|
||||||
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM);
|
||||||
if (pwm == (uint32_t)NC)
|
if (pwm == (PWMName)NC)
|
||||||
error("PwmOut pin mapping failed");
|
error("PwmOut pin mapping failed");
|
||||||
|
|
||||||
obj->pwm = pwm;
|
obj->pwm = pwm;
|
||||||
|
|
Loading…
Reference in New Issue