Talks

Summarized using AI

ROM: the final frontier of mruby

Masayoshi Takahashi and Yurie Yamane • November 13, 2018 • Los Angeles, CA

The video titled 'ROM: the final frontier of mruby' presented by Yurie Yamane and Masayoshi Takahashi during RubyConf 2018 delves into the adaptation of Ruby for embedded systems through a project called 'movie.' The main focus lies on utilizing Read-Only Memory (ROM) to implement Ruby classes efficiently within the constraints of physical devices like microcontrollers. Key points discussed in the video include:

  • Introduction to the Concept of 'Movie': The term 'movie' refers to a lightweight Ruby implementation designed for small embedded systems, targeting applications such as robotics and gaming.
  • Differences from Other Implementations: The movie's resource management strategy sets it apart from standard Ruby versions like CRuby and JRuby, allowing programs to execute without extensive compilation.
  • Use of Microcontrollers: Demonstrations were given using two specific devices: the Nucleo-F401RE with an ARM Cortex-M4 microcontroller and the M5Stack with an ESP32, showcasing their capabilities in interactive applications.
  • Overview of ROM and Memory Types: The talk contrasts various ROM types, emphasizing the advantages of Flash memory for its larger capacity and cost-effectiveness, especially in resource-limited scenarios.
  • Challenges of Dynamic Languages: The complexities tied to Ruby's dynamic nature create challenges in resource management on embedded systems, particularly with memory initialization and garbage collection.
  • Structure and Memory Management in the Movie Project: The movie project involves using C structures to facilitate the internal Ruby object model and ensure efficient runtime management of objects and classes while maintaining Ruby's dynamic capabilities.
  • Encouragement for Global Collaboration: The speakers highlighted the significance of ongoing feedback and contributions from the developer community to further enhance the project.

In concluding, the presentation emphasizes the potential of mruby within embedded systems and calls for collective participation in its development, showcasing the compatibility of dynamic programming with constrained environments. The video serves as an informative exploration into the integration of Ruby within resource-limited devices, paving the way for innovative applications and further developments in this field.

ROM: the final frontier of mruby
Masayoshi Takahashi and Yurie Yamane • November 13, 2018 • Los Angeles, CA

RubyConf 2018 - ROM: the final frontier of mruby by Masayoshi Takahashi and Yurie Yamane

Memory is limited resource of physical devices. Although mruby is smaller than MRI, it’s not small enough for cheap and easily avaiable devices. But there is another frontier: ROM. Many boards has larger Flash ROM than RAM. However, Ruby is too dynamic to put into ROM just as it is. How can we use ROM to implement classes of Ruby, and how small can we make mruby? It’s a thirty-minutes mission to explore strange new worlds.

RubyConf 2018

00:00:16.550 Thank you for coming to this session.
00:00:19.770 This talk starts to explore a topic under the dome.
00:00:24.859 Before we begin, we would like to make some announcements. This presentation will be a little technical and includes some specific details.
00:00:31.890 We will explain the implementation of a movie, and for that, we must use specific terminology during this presentation.
00:00:36.630 You do not need prior knowledge about movies to understand it.
00:00:38.579 Let me introduce ourselves. I'm Yurie Yamane. Along with Masayoshi Takahashi, we are a team involved in developing a movie and applications surrounding it. I am particularly interested in microcomputers and real-time operating systems. I'm also a member of the TAPAS project, which aims to create tools for real-time operating systems. Additionally, I have demonstrated and presented at many exhibitions.
00:01:00.210 We will be hosting RubyKaigi 2019 in Fukuoka next April, and we hope you can come join us.
00:01:06.630 Okay, let's get into the main topics.
00:01:07.160 The topic of this talk is about movies. We will briefly explain what a movie is. A movie is an implementation that closely resembles Ruby, targeting small embedded systems.
00:01:18.460 The primary goal of a movie is to provide a small implementation compared to standard Ruby implementations like CRuby and JRuby.
00:01:22.190 It is compiled with the OpenGL library and targets embedded systems and applications such as robotics and games.
00:01:27.310 We have conducted experiments on various microcontroller boards.
00:01:29.130 In this talk, we will showcase two devices. One is the Nucleo-F401RE, which features an ARM Cortex-M4 microcontroller.
00:01:36.619 The other device is the M5Stack, a well-known board in China and Japan featuring the ESP32 microcontroller.
00:01:56.030 This is a demonstration of the Nucleo board. The LCD screen has a joystick, allowing you to control a cursor.
00:03:52.960 For additional use cases, the M5Stack comes with speakers and buttons to enhance interactivity.
00:05:09.770 Let's explain some basics about microcontrollers.
00:05:12.980 Microcontrollers can be thought of as small computers on a single chip.
00:05:15.290 They contain a processor and various peripherals and are commonly used in smartphones, home appliances, and automobiles.
00:05:25.670 Now, let's get back to the topic of movies.
00:05:27.110 What is the difference between a movie and other implementations? The main difference lies in how a movie manages its resources. It is separated from other environments, allowing you to execute movie programs without the need for compilation.
00:05:48.260 In this situation, you can use ML files that contain bytecode for a movie. For high performance, you can also use bytecode generated by M Ruby, but it is not explicit—it is utilized internally.
00:06:05.260 The content of movies is based on the Ruby 2.0 specification and is expected to be released soon, potentially within the next month.
00:06:28.850 This update is considered a significant advancement for a movie, as it includes integer compatibility while also introducing some incompatibilities.
00:06:45.530 The architecture of the bytecode is entirely different, indicating that you cannot use bytecode generated by version 2.0 in previous versions.
00:07:00.370 This necessitates converting your programs to the newer format.
00:07:16.540 Let's now discuss ROM, which stands for Read-Only Memory. This type of memory is also non-volatile, meaning it retains its contents even when the power is off.
00:07:46.360 The different types of ROMs include EEPROM and Flash memory, primarily used for data storage.
00:08:07.670 EEPROM allows for data to be programmed and erased electrically, while Flash memory permits larger blocks of data to be written.
00:08:25.520 The current trend is to use Flash memory due to its larger capacity and cost-effectiveness.
00:08:54.700 The relationship between EEPROM and Flash memory can be simplified into a part-to-whole analogy.
00:09:03.290 The main reason we focus on ROM is that embedded systems often prioritize limited resources; therefore, efficient memory management is crucial.
00:09:16.580 Also, ROM storage allows data to remain intact even when powered down, which is necessary for various applications.
00:09:30.900 With limited RAM available in many microcontroller systems, we need to explore ways of using ROM to our advantage.
00:09:57.550 A significant challenge in using dynamic languages like Ruby in embedded systems is managing the inherent resource consumption.
00:10:09.300 Since Ruby is a dynamic language, it can be complex to ensure that programs run efficiently on microcontrollers without significant overhead.
00:10:38.100 Dynamic languages require substantial runtime resources, becoming a barrier in constrained environments.
00:10:50.180 In the case of microcontrollers, we need to initialize memory and deal with garbage collection to handle memory management properly.
00:11:03.030 As classes are used in Ruby, you need to prepare all classes before running any script, which can lead to memory constraints.
00:11:29.080 In contrast, more traditional approaches in languages such as C++ or Python may seem more efficient as they do not need to allocate as much memory at runtime.
00:11:49.700 This is particularly noticeable when considering class and object definitions.
00:11:54.050 Since Ruby allows for the addition and deletion of methods and classes dynamically, it requires significant resources.
00:12:11.700 We must find a balance between the highly dynamic capabilities of Ruby and the constraints of embedded systems. We should aim to resolve this contradiction.
00:12:32.870 Now, let’s discuss the structure of the movie project. The memory manager used to implement various data structures in C.
00:12:43.870 For example, the internal layout of Emily uses structures defined in C.
00:12:55.070 Specifying structures allows managing the Ruby object model effectively. Each Ruby class can hold a pointer to its method table and retain instances.
00:13:16.370 We designed a clear and efficient runtime environment for objects.
00:13:27.690 Now, it is important to consider how to manage both Ruby and the movie effectively.
00:13:36.450 A movie must maintain its integrity while providing a user-friendly interface for Ruby developers.
00:13:52.370 This involves ensuring the collections, classes, and data types function efficiently with the core principles of Ruby.
00:14:14.690 As we wrap up, we would like to emphasize the importance of this project. It is constantly evolving, with opportunities for contributions from developers around the world.
00:14:38.590 We appreciate all the feedback and collaboration we have received.
00:14:44.010 Thank you again for being here with us today; without your participation, this journey into the final frontier of mruby would not be possible.
00:15:05.490 Let's embrace the potential of mruby together.
Explore all talks recorded at RubyConf 2018
+86