Merge branch 'psram' of ssh://172.29.0.8/home/folkert/git/PDP-11 into psram
This commit is contained in:
commit
6da098a9b9
4 changed files with 11 additions and 22 deletions
|
@ -17,7 +17,7 @@ board_build.filesystem = littlefs
|
|||
lib_deps = greiman/SdFat@^2.1.2
|
||||
adafruit/Adafruit NeoPixel
|
||||
bblanchon/ArduinoJson@^6.19.4
|
||||
build_flags = -std=gnu++2a -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
|
||||
build_flags = -std=gnu++2a -DESP32=1 -ggdb3 -D_GLIBCXX_USE_C99 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -DCONFIG_SPIRAM_USE_MALLOC
|
||||
build_unflags = -std=gnu++11 -std=gnu++17
|
||||
extra_scripts = pre:prepare.py
|
||||
|
||||
|
|
2
bus.cpp
2
bus.cpp
|
@ -637,7 +637,7 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
|||
uint32_t m_offset = a;
|
||||
|
||||
if (mmu_->is_enabled() || (is_write && (mmu_->getMMR0() & (1 << 8 /* maintenance check */)))) {
|
||||
const uint8_t apf = a >> 13; // active page field
|
||||
uint8_t apf = a >> 13; // active page field
|
||||
|
||||
bool d = space == d_space && mmu_->get_use_data_space(run_mode) ? space == d_space : false;
|
||||
|
||||
|
|
16
memory.cpp
16
memory.cpp
|
@ -1,4 +1,4 @@
|
|||
// (C) 2018-2023 by Folkert van Heusden
|
||||
// (C) 2018-2024 by Folkert van Heusden
|
||||
// Released under MIT license
|
||||
|
||||
#if defined(ESP32)
|
||||
|
@ -14,32 +14,24 @@ memory::memory(const uint32_t size) : size(size)
|
|||
Serial.print(F("Memory size (in bytes, decimal): "));
|
||||
Serial.println(size);
|
||||
|
||||
if (size > 12 * 8192) {
|
||||
if (size > 12 * 8192 && psramFound()) {
|
||||
Serial.println(F("Using PSRAM"));
|
||||
is_psram = true;
|
||||
|
||||
m = reinterpret_cast<uint8_t *>(ps_malloc(size));
|
||||
|
||||
reset();
|
||||
}
|
||||
else {
|
||||
m = new uint8_t[size]();
|
||||
m = reinterpret_cast<uint8_t *>(calloc(1, size));
|
||||
}
|
||||
#else
|
||||
m = new uint8_t[size]();
|
||||
m = reinterpret_cast<uint8_t *>(calloc(1, size));
|
||||
#endif
|
||||
}
|
||||
|
||||
memory::~memory()
|
||||
{
|
||||
#if defined(ESP32)
|
||||
if (is_psram)
|
||||
free(m);
|
||||
else
|
||||
delete [] m;
|
||||
#else
|
||||
delete [] m;
|
||||
#endif
|
||||
}
|
||||
|
||||
void memory::reset()
|
||||
|
|
3
memory.h
3
memory.h
|
@ -13,9 +13,6 @@ class memory
|
|||
private:
|
||||
const uint32_t size { 0 };
|
||||
uint8_t *m { nullptr };
|
||||
#ifdef ESP32
|
||||
bool is_psram { false };
|
||||
#endif
|
||||
|
||||
public:
|
||||
memory(const uint32_t size);
|
||||
|
|
Loading…
Add table
Reference in a new issue