mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
REVONANO - Various temp fixes debug code to get nano to read from the flash. Code has been added to make the execution of systemTask wait until initTask has completed.
Conflicts: flight/pios/common/pios_flashfs_objlist.c
This commit is contained in:
parent
2d3c8b835a
commit
efb6855f6f
@ -171,12 +171,18 @@ int32_t SystemModInitialize(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern volatile int initTaskDone;
|
||||
|
||||
MODULE_INITCALL(SystemModInitialize, 0);
|
||||
/**
|
||||
* System task, periodically executes every SYSTEM_UPDATE_PERIOD_MS
|
||||
*/
|
||||
static void systemTask(__attribute__((unused)) void *parameters)
|
||||
{
|
||||
while (!initTaskDone) {
|
||||
vTaskDelay(10);
|
||||
}
|
||||
|
||||
/* create all modules thread */
|
||||
MODULE_TASKCREATE_ALL;
|
||||
|
||||
|
@ -236,7 +236,7 @@ int32_t PIOS_Flash_EEPROM_Read(struct flash_eeprom_dev *flash_dev, const uint32_
|
||||
current_block_len = MIN(page_len - index_within_page, current_block_len);
|
||||
status = PIOS_Flash_EEPROM_ReadSinglePage(flash_dev, address + bytes_read, &buffer[bytes_read], current_block_len);
|
||||
bytes_read += current_block_len;
|
||||
if (!status) {
|
||||
if (status) {
|
||||
// error occurred during the write operation
|
||||
return status;
|
||||
}
|
||||
@ -282,7 +282,7 @@ int32_t PIOS_Flash_EEPROM_Write(struct flash_eeprom_dev *flash_dev, const uint32
|
||||
current_block_len = MIN(page_len - index_within_page, current_block_len);
|
||||
status = PIOS_Flash_EEPROM_WriteSinglePage(flash_dev, address + bytes_written, &buffer[bytes_written], current_block_len);
|
||||
bytes_written += current_block_len;
|
||||
if (!status) {
|
||||
if (status) {
|
||||
// error occurred during the write operation
|
||||
return status;
|
||||
}
|
||||
@ -391,7 +391,6 @@ static int32_t PIOS_Flash_EEPROM_EraseSector(uintptr_t flash_id, uint32_t addr)
|
||||
}
|
||||
// Rewrite first block of bytes to invalidate the sector.
|
||||
const uint8_t buf[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
return PIOS_Flash_EEPROM_Write(flash_dev, addr, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,10 @@ int32_t PIOS_FLASHFS_Format(uintptr_t fs_id)
|
||||
*/
|
||||
static int32_t PIOS_FLASHFS_ClearObjectTableHeader(struct flashfs_dev *dev)
|
||||
{
|
||||
if (dev->driver->erase_sector(dev->flash_id, 0) != 0) {
|
||||
return -1;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (dev->driver->erase_sector(dev->flash_id, 256 * i) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->driver->write_data(dev->flash_id, 0, (uint8_t *)&dev->cfg->table_magic, sizeof(dev->cfg->table_magic)) != 0) {
|
||||
@ -453,7 +455,6 @@ int32_t PIOS_FLASHFS_ObjLoad(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst
|
||||
if (dev->driver->end_transaction(dev->flash_id) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1320,7 +1320,7 @@ struct flashfs_cfg flash_main_fs_cfg = {
|
||||
.obj_magic = 0x19293949,
|
||||
.obj_table_start = 0x00000010,
|
||||
.obj_table_end = 0x1000,
|
||||
.sector_size = 0xFF,
|
||||
.sector_size = 0x100,
|
||||
.chip_size = 0x10000
|
||||
};
|
||||
#endif /* PIOS_INCLUDE_FLASH_OBJLIST */
|
||||
|
@ -146,14 +146,14 @@ static const struct pios_mpu9250_cfg pios_mpu9250_cfg = {
|
||||
.Smpl_rate_div_no_dlp = 0,
|
||||
// with dlp on output rate is 1000Hz
|
||||
.Smpl_rate_div_dlp = 0,
|
||||
.interrupt_cfg = PIOS_MPU9250_INT_CLR_ANYRD,// | PIOS_MPU9250_INT_LATCH_EN,
|
||||
.interrupt_en = PIOS_MPU9250_INTEN_DATA_RDY,
|
||||
.User_ctl = PIOS_MPU9250_USERCTL_DIS_I2C | PIOS_MPU9250_USERCTL_I2C_MST_EN,
|
||||
.Pwr_mgmt_clk = PIOS_MPU9250_PWRMGMT_PLL_X_CLK,
|
||||
.accel_range = PIOS_MPU9250_ACCEL_8G,
|
||||
.gyro_range = PIOS_MPU9250_SCALE_2000_DEG,
|
||||
.filter = PIOS_MPU9250_LOWPASS_256_HZ,
|
||||
.orientation = PIOS_MPU9250_TOP_180DEG,
|
||||
.interrupt_cfg = PIOS_MPU9250_INT_CLR_ANYRD, // | PIOS_MPU9250_INT_LATCH_EN,
|
||||
.interrupt_en = PIOS_MPU9250_INTEN_DATA_RDY,
|
||||
.User_ctl = PIOS_MPU9250_USERCTL_DIS_I2C | PIOS_MPU9250_USERCTL_I2C_MST_EN,
|
||||
.Pwr_mgmt_clk = PIOS_MPU9250_PWRMGMT_PLL_X_CLK,
|
||||
.accel_range = PIOS_MPU9250_ACCEL_8G,
|
||||
.gyro_range = PIOS_MPU9250_SCALE_2000_DEG,
|
||||
.filter = PIOS_MPU9250_LOWPASS_256_HZ,
|
||||
.orientation = PIOS_MPU9250_TOP_180DEG,
|
||||
.fast_prescaler = PIOS_SPI_PRESCALER_4,
|
||||
.std_prescaler = PIOS_SPI_PRESCALER_64,
|
||||
.max_downsample = 16,
|
||||
|
@ -114,6 +114,9 @@ int main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
volatile int initTaskDone = 0;
|
||||
/**
|
||||
* Initialisation task.
|
||||
*
|
||||
@ -127,6 +130,8 @@ void initTask(__attribute__((unused)) void *parameters)
|
||||
/* Initialize modules */
|
||||
MODULE_INITIALISE_ALL;
|
||||
|
||||
initTaskDone = 1;
|
||||
|
||||
/* terminate this task */
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user