update require("Flash").getFree(); addresses

This commit is contained in:
wilberforce 2018-05-12 09:51:43 +12:00
parent 3f99ffe896
commit c5921bd803
2 changed files with 14 additions and 8 deletions

View File

@ -23,7 +23,8 @@
#else
typedef struct {
uint16_t uuid;
uint8_t type;
uint8_t type; //see BLE_UUID_TYPE_... definitions
uint8_t uuid128[16]; //BLE knows 16/32/128 bit uuids. Espruino supports 16/128.
} PACKED_FLAGS ble_uuid_t;
typedef struct {
//uint8_t addr_id_peer;
@ -44,6 +45,7 @@ typedef struct {
#define BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA 0xFF
#define BLE_UUID_TYPE_UNKNOWN (0)
#define BLE_UUID_TYPE_BLE (1)
#define BLE_UUID_TYPE_128 2
#define MSEC_TO_UNITS(MS,MEH) MS
#endif
@ -56,6 +58,10 @@ typedef struct {
#define PERIPHERAL_LINK_COUNT 1 /**<number of peripheral links used by the application. When changing this number remember to adjust the RAM settings*/
#endif
#ifdef ESP32
#define CENTRAL_LINK_COUNT 1
#endif
#define APP_TIMER_OP_QUEUE_SIZE 2 /**< Size of timer operation queues. */
#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */

View File

@ -700,11 +700,11 @@ void addFlashArea(JsVar *jsFreeFlash, uint32_t addr, uint32_t length) {
JsVar *jshFlashGetFree() {
JsVar *jsFreeFlash = jsvNewEmptyArray();
if (!jsFreeFlash) return 0;
// Space should be reserved here in the parition table - assume 4Mb EEPROM
// Set just after programme save area
// This should be read from the partition table - need to define area
addFlashArea(jsFreeFlash, 0x100000 + FLASH_PAGE * 16, 0x300000-FLASH_PAGE * 16-1);
// Space reserved here in the parition table - using sub type 0x40
// This should be read from the partition table
addFlashArea(jsFreeFlash, 0xE000, 0x2000);
addFlashArea(jsFreeFlash, 0x2B0000, 0x10000);
return jsFreeFlash;
}
@ -728,7 +728,7 @@ size_t jshFlashGetMemMapAddress(size_t ptr) {
return 0;
}
// Flash memory access is offset to 0, so remove starting location as already accounted for
return &romdata_jscode[ptr - FLASH_SAVED_CODE_START ];
return (size_t)&romdata_jscode[ptr - FLASH_SAVED_CODE_START ];
}
unsigned int jshSetSystemClock(JsVar *options) {
@ -741,7 +741,7 @@ unsigned int jshSetSystemClock(JsVar *options) {
* Convert an Espruino pin id to a native ESP32 pin id.
*/
gpio_num_t pinToESP32Pin(Pin pin) {
if ( pin < 40 )
if ( pin < 40 )
return pin + GPIO_NUM_0;
jsError( "pinToESP32Pin: Unknown pin: %d", pin);
return -1;